From 65146a1229604b059e1d637761e9096068a05ab3 Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Fri, 12 Jul 2013 09:33:32 +0200 Subject: Don't display threads without votes in the popular threads --- hyperkitty/templates/recent_activities.html | 2 ++ hyperkitty/views/list.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hyperkitty/templates/recent_activities.html b/hyperkitty/templates/recent_activities.html index 0ba7510..3a475e4 100644 --- a/hyperkitty/templates/recent_activities.html +++ b/hyperkitty/templates/recent_activities.html @@ -79,6 +79,8 @@

Most popular discussions

{% for thread in pop_threads %} {% include "threads/summary_thread.html" with counter=forloop.counter %} + {% empty %} +

No votes this month (yet).

{% endfor %} diff --git a/hyperkitty/views/list.py b/hyperkitty/views/list.py index 8a96fd2..23a668e 100644 --- a/hyperkitty/views/list.py +++ b/hyperkitty/views/list.py @@ -200,7 +200,8 @@ def overview(request, mlist_fqdn=None): "count": poster[2]}) # Popular threads - pop_threads = sorted(threads, key=lambda t: t.likes - t.dislikes, + pop_threads = sorted([ t for t in threads if t.likes - t.dislikes > 0 ], + key=lambda t: t.likes - t.dislikes, reverse=True)[:5] # List activity -- cgit