diff options
author | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2014-02-18 21:43:26 +0000 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2014-02-18 21:46:16 +0000 |
commit | 0951e00fd1faaff25760bc5458c05ccb92bf9441 (patch) | |
tree | 0840fbcd209c321bce2a0dc14a684034943a67c3 | |
parent | 886371f8bb8c4c642d3661ed9a3ee12e267bb72b (diff) |
Added filtering of invalid resolutions
Cards that are closed and have resolution set to one of the
JIRA_INVALID_RESOLUTIONS are removed from generated roadmap
Change-Id: I0fd18a83cf2d08bf429518f68ac10d0213f46db3
Signed-off-by: Milosz Wasilewski <milosz.wasilewski@linaro.org>
-rw-r--r-- | linaroroadmap/settings.py | 2 | ||||
-rw-r--r-- | roadmap/views.py | 13 |
2 files changed, 13 insertions, 2 deletions
diff --git a/linaroroadmap/settings.py b/linaroroadmap/settings.py index 4d13ccb..3ce28b5 100644 --- a/linaroroadmap/settings.py +++ b/linaroroadmap/settings.py @@ -28,6 +28,8 @@ JIRA_PASSWORD = None JIRA_PROJECT = '' JIRA_STATUSES = [] +# name of the resolutions that remove the closed card from the roadmap +JIRA_INVALID_RESOLUTIONS = [] # Custom field that defines relation between blueprint and engineering card # in greenhopper SFID = None diff --git a/roadmap/views.py b/roadmap/views.py index 4ff87fd..4ca8b6d 100644 --- a/roadmap/views.py +++ b/roadmap/views.py @@ -46,6 +46,7 @@ from roadmap.models import ( Component, Status, Project, + Resolution, Label, Milestone, ) @@ -278,9 +279,13 @@ def search(request): name__iexact=form.cleaned_data['label']) cards = None if label: + invalid_resolutions = Resolution.objects.filter( + project__name=settings.JIRA_PROJECT, + name__in=settings.JIRA_INVALID_RESOLUTIONS) cards = Card.objects.filter( labels__in=label, - project__name=settings.JIRA_PROJECT) + project__name=settings.JIRA_PROJECT).exclude( + resolution__in=invalid_resolutions) if not cards or cards.count() == 0: context = RequestContext(request, { 'form': form, @@ -333,7 +338,11 @@ def roadmap(request, roadmap_id): components = Component.objects.filter( project__name=settings.JIRA_PROJECT).order_by("name") current_roadmap = Component.objects.get(pk=roadmap_id) - roadmap_cards = current_roadmap.card_set.all() + invalid_resolutions = Resolution.objects.filter( + project=current_roadmap.project, + name__in=settings.JIRA_INVALID_RESOLUTIONS) + roadmap_cards = current_roadmap.card_set.all().exclude( + resolution__in=invalid_resolutions) epics = roadmap_cards.filter( # labels__name__contains="EPIC", summary__startswith="EPIC", |