mirror of
https://github.com/sartography/protocol-builder-mock.git
synced 2025-01-12 08:44:46 +00:00
Merge pull request #71 from sartography/test-production-519
Fixed bug in required_documents #519
This commit is contained in:
commit
6beab02a72
@ -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):
|
||||
|
25
pb/models.py
25
pb/models.py
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user