Skip to content

Commit 213b9f4

Browse files
committed
Make sure we get a response from PB
1 parent 805e675 commit 213b9f4

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

crc/services/study_service.py

+14-12
Original file line numberDiff line numberDiff line change
@@ -554,18 +554,20 @@ def sync_with_protocol_builder_if_enabled(self, user, specs):
554554
# Process studies in the DB that are no longer in Protocol Builder
555555
for study in db_studies:
556556
# we don't manage Exempt studies
557-
if ('IRB_REVIEW_TYPE' in ProtocolBuilderService.get_irb_info(study.id)[0] and
558-
ProtocolBuilderService.get_irb_info(study.id)[0]['IRB_REVIEW_TYPE'] ==
559-
'Exempt'):
560-
self.__delete_exempt_study(study.id)
561-
562-
else:
563-
pb_study = next((pbs for pbs in pb_studies if pbs.STUDYID == study.id), None)
564-
if not pb_study and study.status != StudyStatus.abandoned:
565-
study.status = StudyStatus.abandoned
566-
StudyService.add_study_update_event(study,
567-
status=StudyStatus.abandoned,
568-
event_type=StudyEventType.automatic)
557+
pb_study_info = ProtocolBuilderService.get_irb_info(study.id)
558+
if len(pb_study_info) > 0:
559+
if ('IRB_REVIEW_TYPE' in ProtocolBuilderService.get_irb_info(study.id)[0] and
560+
ProtocolBuilderService.get_irb_info(study.id)[0]['IRB_REVIEW_TYPE'] ==
561+
'Exempt'):
562+
self.__delete_exempt_study(study.id)
563+
564+
else:
565+
pb_study = next((pbs for pbs in pb_studies if pbs.STUDYID == study.id), None)
566+
if not pb_study and study.status != StudyStatus.abandoned:
567+
study.status = StudyStatus.abandoned
568+
StudyService.add_study_update_event(study,
569+
status=StudyStatus.abandoned,
570+
event_type=StudyEventType.automatic)
569571

570572
db.session.commit()
571573

0 commit comments

Comments
 (0)