From 1895e953747bb5d9d41f249408590e187027b266 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 7 May 2021 15:57:05 +0000 Subject: Fixed issue that caused /submit_trait page to not load properly --- wqflask/utility/helper_functions.py | 10 ++++++---- 1 file 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())] -- cgit v1.2.3