diff options
Diffstat (limited to 'hyperkitty')
-rw-r--r-- | hyperkitty/static/hyperkitty/css/hyperkitty-overview.css | 5 | ||||
-rw-r--r-- | hyperkitty/templates/overview.html | 5 | ||||
-rw-r--r-- | hyperkitty/views/list.py | 26 |
3 files changed, 24 insertions, 12 deletions
diff --git a/hyperkitty/static/hyperkitty/css/hyperkitty-overview.css b/hyperkitty/static/hyperkitty/css/hyperkitty-overview.css index a4f0a8e..07b5f3e 100644 --- a/hyperkitty/static/hyperkitty/css/hyperkitty-overview.css +++ b/hyperkitty/static/hyperkitty/css/hyperkitty-overview.css @@ -26,7 +26,7 @@ position: relative; margin: auto; width: 540px; - height: 330px; + height: 300px; } #fig .axis path, #fig .axis line { @@ -39,6 +39,9 @@ fill: steelBlue; } +#overview .list-stats { + text-align: center; +} #overview p.thread-new { text-align: center; diff --git a/hyperkitty/templates/overview.html b/hyperkitty/templates/overview.html index 4966a01..9fc3336 100644 --- a/hyperkitty/templates/overview.html +++ b/hyperkitty/templates/overview.html @@ -21,6 +21,11 @@ <section id="graph"> <h2>Activities on the list over the last 30 days</h2> + <ul class="list-stats inline"> + <li><span class="participant">{{ num_participants }} participants</span></li> + <li><span class="discussion">{{ num_threads }} discussions</span></li> + </ul> + <div id="fig" /> </section> diff --git a/hyperkitty/views/list.py b/hyperkitty/views/list.py index e6069f8..3880f02 100644 --- a/hyperkitty/views/list.py +++ b/hyperkitty/views/list.py @@ -152,6 +152,7 @@ def overview(request, mlist_fqdn=None): # Get stats for last 30 days today = datetime.datetime.utcnow() + #today -= datetime.timedelta(days=365) #debug # the upper boundary is excluded in the search, add one day end_date = today + datetime.timedelta(days=1) begin_date = end_date - datetime.timedelta(days=32) @@ -204,13 +205,23 @@ def overview(request, mlist_fqdn=None): # Popular threads pop_threads = sorted([ t for t in threads if t.likes - t.dislikes > 0 ], key=lambda t: t.likes - t.dislikes, - reverse=True)[:5] + reverse=True) + + # Threads by category + threads_by_category = defaultdict(list) + for thread in active_threads: + if not thread.category: + continue + if len(threads_by_category[thread.category]) >= 5: + continue + threads_by_category[thread.category].append(thread) # List activity # Use get_messages and not get_threads to count the emails, because # recently active threads include messages from before the start date emails_in_month = store.get_messages(list_name=mlist.name, start=begin_date, end=end_date) + # graph dates = defaultdict(lambda: 0) # no activity by default # populate with all days before adding data. for single_date in daterange(begin_date, end_date): @@ -228,26 +239,19 @@ def overview(request, mlist_fqdn=None): kwargs={'mlist_fqdn': mlist.name}) archives_baseurl = archives_baseurl.rpartition("/")[0] - # Threads by category - threads_by_category = {} - for thread in active_threads: - if not thread.category: - continue - if len(threads_by_category.setdefault(thread.category, [])) >= 5: - continue - threads_by_category[thread.category].append(thread) - context = { 'mlist' : mlist, 'top_threads': top_threads[:5], 'most_active_threads': active_threads[:5], 'top_author': authors, 'top_posters': top_posters, - 'pop_threads': pop_threads, + 'pop_threads': pop_threads[:5], 'threads_by_category': threads_by_category, 'months_list': get_months(store, mlist.name), 'evolution': evolution, 'days': days, 'archives_baseurl': archives_baseurl, + 'num_threads': len(threads), + 'num_participants': len(participants), } return render(request, "overview.html", context) |