From cb6d83943a7e4559339dfec88c01c6ba5200fcdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Tue, 24 Dec 2013 15:26:03 +0100 Subject: [PATCH] only show topics that have activity in top page --- lib/topic_query.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/topic_query.rb b/lib/topic_query.rb index a1704d6461f..a8c199dd147 100644 --- a/lib/topic_query.rb +++ b/lib/topic_query.rb @@ -85,8 +85,11 @@ class TopicQuery end def list_top(sort_order, period) + count = "#{period}_#{sort_order}_count" create_list(:top, unordered: true) do |topics| - topics.joins(:top_topic).order("top_topics.#{period}_#{sort_order}_count DESC, topics.bumped_at DESC") + topics.joins(:top_topic) + .where("top_topics.#{count} > 0") + .order("top_topics.#{count} DESC, topics.bumped_at DESC") end end