From b5a59c10d57efb75c00545c5c4a92cfeab03d5c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Fri, 27 Dec 2013 19:12:53 +0100 Subject: [PATCH] let's try another formula for the top tab --- app/models/top_topic.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/models/top_topic.rb b/app/models/top_topic.rb index 9a30df022..5e1821675 100644 --- a/app/models/top_topic.rb +++ b/app/models/top_topic.rb @@ -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)