diff --git a/qiita_pet/handlers/api_proxy/studies.py b/qiita_pet/handlers/api_proxy/studies.py index 8e211d3fc..3dded0cf2 100644 --- a/qiita_pet/handlers/api_proxy/studies.py +++ b/qiita_pet/handlers/api_proxy/studies.py @@ -105,6 +105,11 @@ def study_get_req(study_id, user_id): study_info['has_access_to_raw_data'] = study.has_access( User(user_id), True) + study_info['show_biom_download_button'] = 'BIOM' in [ + a.artifact_type for a in study.artifacts()] + study_info['show_raw_download_button'] = any([ + True for pt in study.prep_templates() if pt.artifact is not None]) + return {'status': 'success', 'message': '', 'study_info': study_info, diff --git a/qiita_pet/handlers/api_proxy/tests/test_studies.py b/qiita_pet/handlers/api_proxy/tests/test_studies.py index b20da31b8..9bea17b96 100644 --- a/qiita_pet/handlers/api_proxy/tests/test_studies.py +++ b/qiita_pet/handlers/api_proxy/tests/test_studies.py @@ -95,6 +95,8 @@ def test_study_get_req(self): 'owner': 'test@foo.bar', 'ebi_submission_status': 'submitted', 'has_access_to_raw_data': True, + 'show_biom_download_button': True, + 'show_raw_download_button': True, 'ebi_study_accession': 'EBI123456-BB'}, 'editable': True} self.assertEqual(obs, exp) diff --git a/qiita_pet/templates/study_base.html b/qiita_pet/templates/study_base.html index 3657b0449..4ad1297b7 100644 --- a/qiita_pet/templates/study_base.html +++ b/qiita_pet/templates/study_base.html @@ -239,8 +239,10 @@ Upload Files {% end %} - All QIIME maps and BIOMs - {% if study_info['has_access_to_raw_data'] %} + {% if study_info['show_biom_download_button'] %} + All QIIME maps and BIOMs + {% end %} + {% if study_info['has_access_to_raw_data'] and study_info['show_raw_download_button'] %} All raw data {% end %}
Issues opening the downloaded zip?