mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-23 13:18:35 +00:00
Updated to use new ProtocolBuilderCreatorStudy model and schema
This commit is contained in:
parent
db1f3ba6ab
commit
8813098190
@ -6,7 +6,8 @@ import requests
|
||||
|
||||
from crc import app
|
||||
from crc.api.common import ApiError
|
||||
from crc.models.protocol_builder import ProtocolBuilderStudySchema, ProtocolBuilderRequiredDocument
|
||||
from crc.models.protocol_builder import ProtocolBuilderCreatorStudySchema, ProtocolBuilderRequiredDocument
|
||||
|
||||
|
||||
class ProtocolBuilderService(object):
|
||||
STUDY_URL = app.config['PB_USER_STUDIES_URL']
|
||||
@ -33,7 +34,7 @@ class ProtocolBuilderService(object):
|
||||
response = requests.get(url)
|
||||
if response.ok and response.text:
|
||||
try:
|
||||
pb_studies = ProtocolBuilderStudySchema(many=True).loads(response.text)
|
||||
pb_studies = ProtocolBuilderCreatorStudySchema(many=True).loads(response.text)
|
||||
return pb_studies
|
||||
except JSONDecodeError as err:
|
||||
raise ApiError("protocol_builder_error",
|
||||
|
@ -1,9 +1,7 @@
|
||||
import urllib
|
||||
from copy import copy
|
||||
from datetime import datetime
|
||||
from typing import List
|
||||
|
||||
import flask
|
||||
import requests
|
||||
from SpiffWorkflow import WorkflowException
|
||||
from SpiffWorkflow.bpmn.PythonScriptEngine import Box
|
||||
@ -12,15 +10,14 @@ from ldap3.core.exceptions import LDAPSocketOpenError
|
||||
|
||||
from crc import db, session, app
|
||||
from crc.api.common import ApiError
|
||||
from crc.models.data_store import DataStoreModel
|
||||
from crc.models.email import EmailModel
|
||||
from crc.models.file import FileModel, File, FileSchema
|
||||
from crc.models.ldap import LdapSchema
|
||||
|
||||
from crc.models.protocol_builder import ProtocolBuilderStudy, ProtocolBuilderStatus
|
||||
from crc.models.protocol_builder import ProtocolBuilderCreatorStudy
|
||||
from crc.models.study import StudyModel, Study, StudyStatus, Category, WorkflowMetadata, StudyEventType, StudyEvent, \
|
||||
IrbStatus, StudyAssociated, StudyAssociatedSchema
|
||||
from crc.models.task_event import TaskEventModel, TaskEvent
|
||||
StudyAssociated
|
||||
from crc.models.task_event import TaskEventModel
|
||||
from crc.models.task_log import TaskLogModel
|
||||
from crc.models.workflow import WorkflowSpecCategoryModel, WorkflowModel, WorkflowSpecModel, WorkflowState, \
|
||||
WorkflowStatus, WorkflowSpecDependencyFile
|
||||
@ -375,7 +372,7 @@ class StudyService(object):
|
||||
str(app.config['PB_ENABLED']))
|
||||
|
||||
# Get studies matching this user from Protocol Builder
|
||||
pb_studies: List[ProtocolBuilderStudy] = ProtocolBuilderService.get_studies(user.uid)
|
||||
pb_studies: List[ProtocolBuilderCreatorStudy] = ProtocolBuilderService.get_studies(user.uid)
|
||||
|
||||
# Get studies from the database
|
||||
db_studies = session.query(StudyModel).filter_by(user_uid=user.uid).all()
|
||||
@ -393,7 +390,7 @@ class StudyService(object):
|
||||
session.add(db_study)
|
||||
db_studies.append(db_study)
|
||||
|
||||
db_study.update_from_protocol_builder(pb_study)
|
||||
db_study.update_from_protocol_builder(pb_study, user.uid)
|
||||
StudyService._add_all_workflow_specs_to_study(db_study)
|
||||
|
||||
# If there is a new automatic status change and there isn't a manual change in place, record it.
|
||||
|
Loading…
x
Reference in New Issue
Block a user