Skip to content

Commit d803f42

Browse files
authored
Merge pull request #2092 from antgonza/listing-tags
Listing tags
2 parents 64e7225 + e306f32 commit d803f42

File tree

8 files changed

+302
-654
lines changed

8 files changed

+302
-654
lines changed

qiita_db/test/test_util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,8 @@ def test_generate_study_list(self):
960960
'ebi_study_accession': 'EBI123456-BB',
961961
'study_title': ('Identification of the Microbiomes for Cannabis '
962962
'Soils'),
963-
'number_samples_collected': 27
963+
'number_samples_collected': 27,
964+
'study_tags': None
964965
}]
965966
obs_info = qdb.util.generate_study_list([1, 2, 3, 4], False)
966967
self.assertEqual(obs_info, exp_info)

qiita_db/util.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,9 @@ def generate_study_list(study_ids, build_samples, public_only=False):
13641364
(SELECT array_agg(email ORDER BY email) FROM qiita.study_users
13651365
LEFT JOIN qiita.qiita_user USING (email)
13661366
WHERE study_id=qiita.study.study_id) AS shared_with_email
1367+
- all study tags
1368+
(SELECT array_agg(study_tag) FROM qiita.per_study_tags
1369+
WHERE study_id=qiita.study.study_id) AS study_tags
13671370
"""
13681371
with qdb.sql_connection.TRN:
13691372
sql = """
@@ -1429,7 +1432,9 @@ def generate_study_list(study_ids, build_samples, public_only=False):
14291432
WHERE study_id=qiita.study.study_id) AS shared_with_name,
14301433
(SELECT array_agg(email ORDER BY email) FROM qiita.study_users
14311434
LEFT JOIN qiita.qiita_user USING (email)
1432-
WHERE study_id=qiita.study.study_id) AS shared_with_email
1435+
WHERE study_id=qiita.study.study_id) AS shared_with_email,
1436+
(SELECT array_agg(study_tag) FROM qiita.per_study_tags
1437+
WHERE study_id=qiita.study.study_id) AS study_tags
14331438
FROM qiita.study
14341439
LEFT JOIN qiita.study_person ON (
14351440
study_person_id=principal_investigator_id)

qiita_pet/handlers/study_handlers/tests/test_listing_handlers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def setUp(self):
7878
'publication_doi': ['10.100/123456', '10.100/7891011'],
7979
'publication_pid': ['123456', '7891011'],
8080
'pi': ('PI_dude@foo.bar', 'PIDude'),
81+
'study_tags': None,
8182
'proc_data_info': PROC_DATA_INFO
8283
}
8384
self.exp = [self.single_exp]
@@ -124,6 +125,7 @@ def test_build_study_info_empty_study(self):
124125
'study_id': 2,
125126
'ebi_study_accession': None,
126127
'study_title': 'My study',
128+
'study_tags': None,
127129
'number_samples_collected': 0})
128130

129131
self.assertItemsEqual(obs, self.exp)
@@ -280,7 +282,8 @@ def setUp(self):
280282
'Future studies will attempt to analyze the soils and '
281283
'rhizospheres from the same location at different time '
282284
'points in the plant lifecycle.'),
283-
'number_samples_collected': 27}],
285+
'number_samples_collected': 27,
286+
'study_tags': None}],
284287
'sEcho': 1021,
285288
'iTotalDisplayRecords': 1}
286289
self.empty = {'aaData': [],

0 commit comments

Comments
 (0)