diff options
author | zsloan | 2021-05-07 15:57:05 +0000 |
---|---|---|
committer | zsloan | 2021-05-07 15:57:05 +0000 |
commit | 1895e953747bb5d9d41f249408590e187027b266 (patch) | |
tree | e4bf216d26dd6b4597dff54b391bfe8ff974ef9b /wqflask/utility/helper_functions.py | |
parent | a2627777d51b969869d8647624ce008fc9454c7b (diff) | |
download | genenetwork2-1895e953747bb5d9d41f249408590e187027b266.tar.gz |
Fixed issue that caused /submit_trait page to not load properly
Diffstat (limited to 'wqflask/utility/helper_functions.py')
-rw-r--r-- | wqflask/utility/helper_functions.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/wqflask/utility/helper_functions.py b/wqflask/utility/helper_functions.py index ecc075ae..50e00421 100644 --- a/wqflask/utility/helper_functions.py +++ b/wqflask/utility/helper_functions.py @@ -57,14 +57,16 @@ def get_trait_db_obs(self, trait_db_list): def get_species_groups(): """Group each species into a group""" _menu = {} + for species, group_name in g.db.execute( "SELECT s.MenuName, i.InbredSetName FROM InbredSet i " "INNER JOIN Species s ON s.SpeciesId = i.SpeciesId " "ORDER BY i.SpeciesId ASC, i.Name ASC").fetchall(): - if _menu.get(species): - _menu = _menu[species].append(group_name) - else: - _menu[species] = [group_name] + if species in _menu: + if _menu.get(species): + _menu = _menu[species].append(group_name) + else: + _menu[species] = [group_name] return [{"species": key, "groups": value} for key, value in list(_menu.items())] |