Merge pull request #71 from sartography/test-production-519

Fixed bug in required_documents #519
This commit is contained in:
Mike Cullerton 2021-11-11 15:40:16 -05:00 committed by GitHub
commit 6beab02a72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 25 deletions

View File

@ -12,7 +12,10 @@ def get_user_studies(uva_id):
def required_docs(studyid):
docs = session.query(RequiredDocument).filter(RequiredDocument.STUDYID == studyid).all()
return RequiredDocumentSchema(many=True).dump(docs)
docs_schema = RequiredDocumentSchema(many=True).dump(docs)
return {'AUXDOCS': docs_schema,
'TEMPLATEDOCS': [],
'OTHERDOCS': []}
def investigators(studyid):

View File

@ -262,30 +262,7 @@ class RequiredDocument(db.Model):
class RequiredDocumentSchema(ma.Schema):
class Meta:
i_aux_docs = []
include_relationships = True
load_instance = True
fields = ("AUXDOCS", "OTHERDOCS", "TEMPLATEDOCS")
# fields = ("SS_AUXILIARY_DOC_TYPE_ID", "AUXILIARY_DOC")
AUXDOCS = fields.Method("get_aux_docs")
OTHERDOCS = fields.Method("get_other_docs")
TEMPLATEDOCS = fields.Method("get_template_docs")
@staticmethod
def get_aux_docs(obj):
aux_docs = []
if obj is not None and hasattr(obj, 'AUXILIARY_DOC') and hasattr(obj, 'SS_AUXILIARY_DOC_TYPE_ID'):
aux_docs.append({'AUXILIARY_DOC': obj.AUXILIARY_DOC, 'SS_AUXILIARY_DOC_TYPE_ID': obj.SS_AUXILIARY_DOC_TYPE_ID})
return aux_docs
@staticmethod
def get_other_docs(obj):
return []
@staticmethod
def get_template_docs(obj):
return []
fields = ("SS_AUXILIARY_DOC_TYPE_ID", "AUXILIARY_DOC")
class IRBStatus(db.Model):