FIX: change top score formula

Adds more weight to `likes` (it's now the same weight as `post_count`)
This commit is contained in:
Régis Hanol 2014-12-03 11:51:49 +01:00
parent feb0a42d87
commit 7edb88a5a8

View file

@ -119,7 +119,7 @@ class TopTopic < ActiveRecord::Base
WITH top AS (
SELECT CASE
WHEN topics.created_at < :from THEN 0
ELSE log(greatest(#{period}_views_count, 1)) + #{period}_likes_count + #{period}_posts_count * 2
ELSE log(greatest(#{period}_views_count, 1)) + #{period}_likes_count * 2 + #{period}_posts_count * 2
END AS score,
topic_id
FROM top_topics