mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-23 13:18:35 +00:00
add the new study to the session after we run update_from_protocol_builder
This commit is contained in:
parent
791ab20f8c
commit
be2b7c07ef
@ -404,13 +404,14 @@ class StudyService(object):
|
|||||||
db_study = session.query(StudyModel).filter(StudyModel.id == pb_study.STUDYID).first()
|
db_study = session.query(StudyModel).filter(StudyModel.id == pb_study.STUDYID).first()
|
||||||
#db_study = next((s for s in db_studies if s.id == pb_study.STUDYID), None)
|
#db_study = next((s for s in db_studies if s.id == pb_study.STUDYID), None)
|
||||||
|
|
||||||
|
add_study = False
|
||||||
if not db_study:
|
if not db_study:
|
||||||
db_study = StudyModel(id=pb_study.STUDYID)
|
db_study = StudyModel(id=pb_study.STUDYID)
|
||||||
db_study.status = None # Force a new sa
|
db_study.status = None # Force a new sa
|
||||||
new_status = StudyStatus.in_progress
|
new_status = StudyStatus.in_progress
|
||||||
new_progress_status = ProgressStatus.in_progress
|
new_progress_status = ProgressStatus.in_progress
|
||||||
|
|
||||||
session.add(db_study)
|
add_study = True
|
||||||
db_studies.append(db_study)
|
db_studies.append(db_study)
|
||||||
|
|
||||||
db_study.update_from_protocol_builder(pb_study, user.uid)
|
db_study.update_from_protocol_builder(pb_study, user.uid)
|
||||||
@ -425,6 +426,8 @@ class StudyService(object):
|
|||||||
StudyService.add_study_update_event(db_study,
|
StudyService.add_study_update_event(db_study,
|
||||||
status=new_status,
|
status=new_status,
|
||||||
event_type=StudyEventType.automatic)
|
event_type=StudyEventType.automatic)
|
||||||
|
if add_study:
|
||||||
|
session.add(db_study)
|
||||||
|
|
||||||
# Mark studies as inactive that are no longer in Protocol Builder
|
# Mark studies as inactive that are no longer in Protocol Builder
|
||||||
for study in db_studies:
|
for study in db_studies:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user