@@ -554,18 +554,20 @@ def sync_with_protocol_builder_if_enabled(self, user, specs):
554
554
# Process studies in the DB that are no longer in Protocol Builder
555
555
for study in db_studies :
556
556
# 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 )
569
571
570
572
db .session .commit ()
571
573
0 commit comments