From e3087d4878897bdbfc9c97fbd454ccb2d33f10c4 Mon Sep 17 00:00:00 2001 From: Milosz Wasilewski Date: Tue, 1 Apr 2014 23:54:05 +0100 Subject: views.py: fixed roadmap start/end dates If there are no valid cards in the roadmap missing start/end dates don't cause Internal Server Error any more. Change-Id: I0aea582f83e3913893df186afa2b327e97a4904b Signed-off-by: Milosz Wasilewski --- roadmap/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/roadmap/views.py b/roadmap/views.py index 4ca8b6d..29a1b34 100644 --- a/roadmap/views.py +++ b/roadmap/views.py @@ -357,13 +357,15 @@ def roadmap(request, roadmap_id): non_epics.exclude(fix_version__name="ONGOING").aggregate( Min("fix_version__fix_date")).items()[0][1]]) # labels are on the right, so 2 months leading time line is enough - roadmap_start = roadmap_start - timedelta(days=60) + if roadmap_start: + roadmap_start = roadmap_start - timedelta(days=60) roadmap_end = max( [non_epics.aggregate(Max("start")).items()[0][1], non_epics.exclude(fix_version__name="ONGOING").aggregate( Max("fix_version__fix_date")).items()[0][1]]) - roadmap_end = roadmap_end + timedelta(days=180) + if roadmap_end: + roadmap_end = roadmap_end + timedelta(days=180) template = loader.get_template('roadmap/roadmap.html') context = RequestContext(request, { 'current': current_roadmap, -- cgit v1.2.3