Fix ordering for event.average_voting in events#index

This commit is contained in:
Stella Rouzi 2015-08-06 07:41:20 +03:00
parent a73ca335a9
commit 2a6ca7b0ff
2 changed files with 2 additions and 2 deletions

View file

@ -77,7 +77,7 @@ class Event < ActiveRecord::Base
@total_rating = @total_rating + vote.rating
end
@total = votes.size
number_with_precision(@total_rating / @total.to_f, precision: 2, strip_insignificant_zeros: true)
@total_rating > 0 ? number_with_precision(@total_rating / @total.to_f, precision: 2, strip_insignificant_zeros: true) : 0
end
def submitter