diff options
author | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2014-04-01 23:54:05 +0100 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2014-04-01 23:55:11 +0100 |
commit | e3087d4878897bdbfc9c97fbd454ccb2d33f10c4 (patch) | |
tree | 3d834275d51045b4c25102a9a03bd92d4be53b68 | |
parent | 4ed4abdbf1a680165cffb22b62e6b0e4774e48da (diff) |
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 <milosz.wasilewski@linaro.org>
-rw-r--r-- | roadmap/views.py | 6 |
1 files 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, |