let's try another formula for the top tab

This commit is contained in:
Régis Hanol 2013-12-27 19:12:53 +01:00
parent 9c8e50351d
commit b5a59c10d5

View file

@ -67,13 +67,8 @@ class TopTopic < ActiveRecord::Base
end
def self.compute_top_score_for(period)
exec_sql("UPDATE top_topics
SET #{period}_score = log(
1 +
(#{period}_posts_count) *
(#{period}_likes_count / 2.0 + 1.0) *
(#{period}_views_count / 100.0 + 1.0)
)")
# log(views) + (posts * likes)
exec_sql("UPDATE top_topics SET #{period}_score = log(#{period}_views_count + 1) + (#{period}_posts_count * #{period}_likes_count)")
end
def self.start_of(period)