Improved results and stats percentages

This commit is contained in:
María Checa
2017-10-20 17:18:54 +02:00
parent dfa8f4590a
commit e85c98f4b4
3 changed files with 15 additions and 37 deletions

View File

@@ -41,7 +41,7 @@ class Poll::Question::Answer < ActiveRecord::Base
end
def total_votes_percentage
((total_votes*100) / question.answers_total_votes).round(2) rescue 0
question.answers_total_votes == 0 ? 0 : (total_votes * 100) / question.answers_total_votes
end
def set_most_voted