Fixing filtering in task controller

* _get_task_resources_with_results() was given one extra parameter
  "wf_ex_id" whereas it was already passed in **filters. It was all
  wrong as we just need to pass "workflow_execution_id" in filters
* There was also wrong "id" filter which gave empty db list every
  time

TODO:
 * Add tests to check filtering in controllers

Change-Id: Ibce9a40bc63ed63173b91e5f03cf71125537cf73
This commit is contained in:
Renat Akhmerov 2016-07-14 16:51:22 +07:00
parent d0009166e0
commit 1dbb3f2525
1 changed files with 2 additions and 7 deletions

View File

@ -109,7 +109,7 @@ def _get_task_resource_with_result(task_ex):
return task
def _get_task_resources_with_results(wf_ex_id=None, marker=None, limit=None,
def _get_task_resources_with_results(marker=None, limit=None,
sort_keys='created_at', sort_dirs='asc',
fields='', **filters):
"""Return all tasks within the execution.
@ -133,9 +133,6 @@ def _get_task_resources_with_results(wf_ex_id=None, marker=None, limit=None,
constructing 'next' link.
:param filters: Optional. A list of filters to apply to the result.
"""
if wf_ex_id:
filters['workflow_execution_id'] = wf_ex_id
return rest_utils.get_all(
Tasks,
Task,
@ -357,9 +354,8 @@ class ExecutionTasksController(rest.RestController):
acl.enforce('tasks:list', context.ctx())
filters = rest_utils.filters_to_dict(
wf_ex_id=workflow_execution_id,
workflow_execution_id=workflow_execution_id,
created_at=created_at,
id=id,
workflow_name=workflow_name,
workflow_id=workflow_id,
state=state,
@ -379,7 +375,6 @@ class ExecutionTasksController(rest.RestController):
filters)
return _get_task_resources_with_results(
wf_ex_id=workflow_execution_id,
marker=marker,
limit=limit,
sort_keys=sort_keys,