Fix filtering of automatic worklist contents

This commit fixes a bug where stories or tasks which were related to
a project which wasn't in a project-group wouldn't show up in an
automatic worklist, even if it matched the filters set on the
worklist.

Change-Id: I652f11f60f748ad5a34cb04c596f1925e2167437
This commit is contained in:
Adam Coldrick
2016-04-11 13:48:38 +00:00
parent 428bd522f2
commit 16157204f2

View File

@@ -386,10 +386,10 @@ def filter_stories(worklist, filters):
subquery = api_base.model_query(models.Story.id).distinct().subquery()
query = api_base.model_query(models.StorySummary)
query = query.join(subquery, models.StorySummary.id == subquery.c.id)
query = query.join(models.Task,
models.Project,
models.project_group_mapping,
models.ProjectGroup)
query = query.outerjoin(models.Task,
models.Project,
models.project_group_mapping,
models.ProjectGroup)
for criterion in filter.criteria:
attr = translate_criterion_to_field(criterion)
if hasattr(models.StorySummary, attr):
@@ -436,9 +436,9 @@ def filter_tasks(worklist, filters):
filter_queries = []
for filter in filters:
query = api_base.model_query(models.Task)
query = query.join(models.Project,
models.project_group_mapping,
models.ProjectGroup)
query = query.outerjoin(models.Project,
models.project_group_mapping,
models.ProjectGroup)
for criterion in filter.criteria:
attr = translate_criterion_to_field(criterion)
if hasattr(models.Task, attr):