mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-22 20:58:28 +00:00
Make sure we don't try to get WorkflowMetadata if the spec does not exist
This was raising a 500 error
This commit is contained in:
parent
dd7eddb936
commit
531802f927
@ -243,9 +243,10 @@ 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()
|
||||
spec = WorkflowSpecService().get_spec(workflow.workflow_spec_id)
|
||||
workflow_meta = WorkflowMetadata.from_workflow(workflow, spec)
|
||||
if study and study.status in [StudyStatus.open_for_enrollment, StudyStatus.in_progress]:
|
||||
task_events.append(TaskEvent(event, study, workflow_meta))
|
||||
if spec is not None:
|
||||
workflow_meta = WorkflowMetadata.from_workflow(workflow, spec)
|
||||
if study and 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)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user