summaryrefslogtreecommitdiffstats
path: root/hyperkitty/views/list.py
diff options
context:
space:
mode:
authorAslak Knutsen <aslak@redhat.com>2013-03-05 02:09:16 +0100
committerAslak Knutsen <aslak@redhat.com>2013-03-05 10:24:03 +0100
commit331ea452fa1186e096e3a905b2b729a599d07b42 (patch)
treea8359f49cb8df027656067d1b67b522b13a1871a /hyperkitty/views/list.py
parent2df6a3857a9d75588a2242ae19d83b3355ad4bcc (diff)
downloadhyperkitty-331ea452fa1186e096e3a905b2b729a599d07b42.tar.gz
hyperkitty-331ea452fa1186e096e3a905b2b729a599d07b42.tar.xz
hyperkitty-331ea452fa1186e096e3a905b2b729a599d07b42.zip
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.
Diffstat (limited to 'hyperkitty/views/list.py')
-rw-r--r--hyperkitty/views/list.py7
1 files changed, 5 insertions, 2 deletions
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