Skip to content
This repository
Browse code

changed average calculation

  • Loading branch information...
commit 7aba5d99a8a394eb62175a1af8b0eda0eb103b3e 1 parent b5680d0
Jorge Silveira authored

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. +1 1  lib/letsrate/model.rb
2  lib/letsrate/model.rb
@@ -27,7 +27,7 @@ def update_rate_average(stars, dimension=nil)
27 27 end
28 28 else
29 29 a = average(dimension)
30   - a.avg = (a.avg + stars) / (a.qty+1)
  30 + a.avg = (a.avg*a.qty + stars) / (a.qty+1)
31 31 a.qty = a.qty + 1
32 32 a.save!
33 33 end

0 comments on commit 7aba5d9

Please sign in to comment.
Something went wrong with that request. Please try again.