Add filter for non-active studies so that the events for them do not get returned to the front end for the 'InProgress' data pane.

This commit is contained in:
Kelly McDonald 2021-04-27 12:13:49 -04:00
parent 4946f77f58
commit 799747d638
1 changed files with 3 additions and 2 deletions

View File

@ -6,7 +6,7 @@ from crc import session
from crc.api.common import ApiError, ApiErrorSchema from crc.api.common import ApiError, ApiErrorSchema
from crc.models.api_models import WorkflowApiSchema from crc.models.api_models import WorkflowApiSchema
from crc.models.file import FileModel, LookupDataSchema from crc.models.file import FileModel, LookupDataSchema
from crc.models.study import StudyModel, WorkflowMetadata from crc.models.study import StudyModel, WorkflowMetadata, StudyStatus
from crc.models.task_event import TaskEventModel, TaskEvent, TaskEventSchema from crc.models.task_event import TaskEventModel, TaskEvent, TaskEventSchema
from crc.models.user import UserModelSchema from crc.models.user import UserModelSchema
from crc.models.workflow import WorkflowModel, WorkflowSpecModelSchema, WorkflowSpecModel, WorkflowSpecCategoryModel, \ from crc.models.workflow import WorkflowModel, WorkflowSpecModelSchema, WorkflowSpecModel, WorkflowSpecCategoryModel, \
@ -145,7 +145,8 @@ def get_task_events(action = None, workflow = None, study = None):
study = session.query(StudyModel).filter(StudyModel.id == event.study_id).first() study = session.query(StudyModel).filter(StudyModel.id == event.study_id).first()
workflow = session.query(WorkflowModel).filter(WorkflowModel.id == event.workflow_id).first() workflow = session.query(WorkflowModel).filter(WorkflowModel.id == event.workflow_id).first()
workflow_meta = WorkflowMetadata.from_workflow(workflow) workflow_meta = WorkflowMetadata.from_workflow(workflow)
task_events.append(TaskEvent(event, study, workflow_meta)) 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) return TaskEventSchema(many=True).dump(task_events)