From 331ea452fa1186e096e3a905b2b729a599d07b42 Mon Sep 17 00:00:00 2001 From: Aslak Knutsen Date: Tue, 5 Mar 2013 02:09:16 +0100 Subject: Change Activity Graph from Protovis to d3 (#43) Fixes failing javascipt in Opera and Chrome resulting in no graph and no other javascript features. Changed to precalculate all days in the begin_date...end_date date range before matching email counts to ensure we have data points for all days in the range. --- hyperkitty/views/list.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'hyperkitty/views/list.py') diff --git a/hyperkitty/views/list.py b/hyperkitty/views/list.py index a9e5071..59471ba 100644 --- a/hyperkitty/views/list.py +++ b/hyperkitty/views/list.py @@ -31,7 +31,7 @@ from django.utils import formats from django.utils.dateformat import format as date_format from hyperkitty.models import Tag, Favorite -from hyperkitty.lib import get_months, get_store, get_display_dates +from hyperkitty.lib import get_months, get_store, get_display_dates, daterange from hyperkitty.lib.voting import get_votes from forms import SearchForm @@ -160,7 +160,6 @@ def _thread_list(request, mlist, threads, template_name='thread_list.html', extr return render(request, template_name, context) - def overview(request, mlist_fqdn=None): if not mlist_fqdn: return redirect('/') @@ -210,6 +209,10 @@ def overview(request, mlist_fqdn=None): emails_in_month = store.get_messages(list_name=mlist.name, start=begin_date, end=end_date) dates = defaultdict(lambda: 0) # no activity by default + # populate with all days before adding data. + for single_date in daterange(begin_date, end_date): + dates[single_date.strftime("%Y-%m-%d")] = 0 + for email in emails_in_month: date_str = email.date.strftime("%Y-%m-%d") dates[date_str] = dates[date_str] + 1 -- cgit