aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility/helper_functions.py
diff options
context:
space:
mode:
authorzsloan2021-05-07 15:57:05 +0000
committerzsloan2021-05-07 15:57:05 +0000
commit1895e953747bb5d9d41f249408590e187027b266 (patch)
treee4bf216d26dd6b4597dff54b391bfe8ff974ef9b /wqflask/utility/helper_functions.py
parenta2627777d51b969869d8647624ce008fc9454c7b (diff)
downloadgenenetwork2-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.py10
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())]