Reputation: 1856
I've got a grade
function:
def grade(submission)
score_counter = 0
total_score = submission.test.questions.size
#the scoring logic is here
return (score_counter/total_score)*100
end
The intention is to return a percent score, but all that shows up in my view is 0
. If I just try to return score_counter
and total_score
separately, they display the correct values. Any ideas?
Upvotes: 1
Views: 42
Reputation: 23671
You need to change your values to float
(score_counter.to_f / total_score.to_f) * 100
Upvotes: 2