From d30405226e4b641a2201e6673ed79a703a1bc144 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Fri, 10 Dec 2021 16:16:33 -0500 Subject: [PATCH] Script to get the new progress_status value --- crc/scripts/get_study_progress_status.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 crc/scripts/get_study_progress_status.py diff --git a/crc/scripts/get_study_progress_status.py b/crc/scripts/get_study_progress_status.py new file mode 100644 index 00000000..d2d6d2ee --- /dev/null +++ b/crc/scripts/get_study_progress_status.py @@ -0,0 +1,21 @@ +from crc import session +from crc.models.study import StudyModel +from crc.scripts.script import Script + + +class GetStudyProgressStatus(Script): + + def get_description(self): + return """ + Get the progress status of the current study. + Progress status is only set when `status` is `in_progress`. + Progress status can be one of `in_progress`, `submitted_for_pre_review`, `in_pre_review`, `returned_from_pre_review`, `pre_review_complete`, `agenda_date_set`, `approved`, `approved_with_conditions`, `deferred`, or `disapproved`. + """ + + def do_task_validate_only(self, task, study_id, workflow_id, *args, **kwargs): + return self.do_task(task, study_id, workflow_id, *args, **kwargs) + + def do_task(self, task, study_id, workflow_id, *args, **kwargs): + progress_status = session.query(StudyModel.progress_status).filter(StudyModel.id == study_id).scalar() + if progress_status: + return progress_status.value