Fix for a bug in the File service where it was being overly restrictive.

This commit is contained in:
Dan Funk 2020-02-10 16:27:57 -05:00
parent 1d24ebe382
commit 9f0eb8477a
1 changed files with 13 additions and 8 deletions

View File

@ -64,14 +64,19 @@ class FileService(object):
@staticmethod @staticmethod
def get_files(workflow_spec_id=None, study_id=None, workflow_id=None, task_id=None, form_field_key=None): def get_files(workflow_spec_id=None, study_id=None, workflow_id=None, task_id=None, form_field_key=None):
schema = FileModelSchema(many=True) query = session.query(FileModel)
results = session.query(FileModel).filter_by( if workflow_spec_id:
workflow_spec_id=workflow_spec_id, query = query.filter_by(workflow_spec_id=workflow_spec_id)
study_id=study_id, if study_id:
workflow_id=workflow_id, query = query.filter_by(study_id=study_id)
task_id=str(task_id), if workflow_id:
form_field_key=form_field_key query = query.filter_by(workflow_id=workflow_id)
).all() if task_id:
query = query.filter_by(task_id=str(task_id))
if form_field_key:
query = query.filter_by(form_field_key=form_field_key)
results = query.all()
return results return results
@staticmethod @staticmethod