Standalone workflows do not have a study_id, and we do not record task events for them.

This commit is contained in:
mike cullerton 2021-05-14 15:34:29 -04:00
parent ade7812540
commit a9e3f7c861
1 changed files with 3 additions and 2 deletions

View File

@ -163,8 +163,9 @@ def get_task_events(action = None, workflow = None, study = None):
study = session.query(StudyModel).filter(StudyModel.id == event.study_id).first()
workflow = session.query(WorkflowModel).filter(WorkflowModel.id == event.workflow_id).first()
workflow_meta = WorkflowMetadata.from_workflow(workflow)
if study.status in [StudyStatus.open_for_enrollment, StudyStatus.in_progress]:
task_events.append(TaskEvent(event, study, workflow_meta))
if study:
if study.status in [StudyStatus.open_for_enrollment, StudyStatus.in_progress]:
task_events.append(TaskEvent(event, study, workflow_meta))
return TaskEventSchema(many=True).dump(task_events)