diff options
author | Aurélien Bompard <aurelien@bompard.org> | 2013-07-12 09:33:32 +0200 |
---|---|---|
committer | Aurélien Bompard <aurelien@bompard.org> | 2013-07-12 09:33:32 +0200 |
commit | 65146a1229604b059e1d637761e9096068a05ab3 (patch) | |
tree | 6e8116eddc68430e1edf4090c62de1e441b89be1 | |
parent | a421b63e60f766f65df4e33dd67ad404dc6a07d3 (diff) | |
download | hyperkitty-65146a1229604b059e1d637761e9096068a05ab3.tar.gz hyperkitty-65146a1229604b059e1d637761e9096068a05ab3.tar.xz hyperkitty-65146a1229604b059e1d637761e9096068a05ab3.zip |
Don't display threads without votes in the popular threads
-rw-r--r-- | hyperkitty/templates/recent_activities.html | 2 | ||||
-rw-r--r-- | hyperkitty/views/list.py | 3 |
2 files changed, 4 insertions, 1 deletions
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 @@ <h3>Most popular discussions</h3> {% for thread in pop_threads %} {% include "threads/summary_thread.html" with counter=forloop.counter %} + {% empty %} + <p>No votes this month (yet).</p> {% endfor %} </section> </div> 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 |