app/models/flexible_feeds/event.rb in flexible_feeds-0.1.0 vs app/models/flexible_feeds/event.rb in flexible_feeds-0.2.1
- old
+ new
@@ -48,12 +48,9 @@
end
# Thanks to Evan Miller
# http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
def calculate_popularity(pos, n)
- return 0 if n == 0
- z = 1.96
- phat = 1.0*pos/n
- (phat + z*z/(2*n) - z * Math.sqrt((phat*(1-phat)+z*z/(4*n))/n))/(1+z*z/n)
+ PopularityCalculator.new(pos, n).get_popularity
end
end
end