Allow frontend to honor 'view as' and fix problem with tests
This commit is contained in:
parent
8c309e9a41
commit
4fa0f9720a
|
@ -124,9 +124,11 @@ def restart_workflow(workflow_id, clear_data=False):
|
|||
|
||||
def get_task_events(action = None, workflow = None, study = None):
|
||||
"""Provides a way to see a history of what has happened, or get a list of tasks that need your attention."""
|
||||
studies = session.query(StudyModel).filter(StudyModel.user_uid==g.user.uid)
|
||||
user = UserService.current_user(allow_admin_impersonate=True)
|
||||
studies = session.query(StudyModel).filter(StudyModel.user_uid==user.uid)
|
||||
studyids = [s.id for s in studies]
|
||||
query = session.query(TaskEventModel).filter(TaskEventModel.study_id.in_(studyids))
|
||||
query = session.query(TaskEventModel).filter((TaskEventModel.study_id.in_(studyids)) | \
|
||||
(TaskEventModel.user_uid==user.uid))
|
||||
if action:
|
||||
query = query.filter(TaskEventModel.action == action)
|
||||
if workflow:
|
||||
|
|
|
@ -200,7 +200,7 @@ class WorkflowApiSchema(ma.Schema):
|
|||
def make_workflow(self, data, **kwargs):
|
||||
keys = ['id', 'status', 'next_task', 'navigation',
|
||||
'workflow_spec_id', 'spec_version', 'is_latest_spec', "total_tasks", "completed_tasks",
|
||||
"last_updated", "title"]
|
||||
"last_updated", "is_review", "title"]
|
||||
filtered_fields = {key: data[key] for key in keys}
|
||||
filtered_fields['next_task'] = TaskSchema().make_task(data['next_task'])
|
||||
return WorkflowApi(**filtered_fields)
|
||||
|
|
Loading…
Reference in New Issue