aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorBonfaceKilz2021-05-10 21:01:45 +0300
committerBonfaceKilz2021-05-26 20:01:28 +0300
commit4b3e16df73502c1b4802b6de60f743093351ebc5 (patch)
tree3ad9af259c55458bac0d9d455565514cc78ce066 /wqflask
parent2e99ad2c1893a2a09a282f3ea0a9beb39f688f0b (diff)
downloadgenenetwork2-4b3e16df73502c1b4802b6de60f743093351ebc5.tar.gz
api: gen_menu: Replace get_species with get_all_species from gn3
* wqflask/wqflask/api/gen_menu.py (gen_dropdown_json): Use new `get_all_species` function. (get_species): Remove it.
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/api/gen_menu.py18
1 files changed, 3 insertions, 15 deletions
diff --git a/wqflask/wqflask/api/gen_menu.py b/wqflask/wqflask/api/gen_menu.py
index 0c1120ab..a699a484 100644
--- a/wqflask/wqflask/api/gen_menu.py
+++ b/wqflask/wqflask/api/gen_menu.py
@@ -1,29 +1,17 @@
+from gn3.db.species import get_all_species
def gen_dropdown_json(conn):
"""Generates and outputs (as json file) the data for the main dropdown menus on
the home page
"""
-
- species = get_species(conn)
+ species = get_all_species(conn)
groups = get_groups(species, conn)
types = get_types(groups, conn)
datasets = get_datasets(types, conn)
-
- data = dict(species=species,
+ return dict(species=species,
groups=groups,
types=types,
datasets=datasets)
- return data
-
-
-def get_species(conn):
- """Build species list"""
- with conn.cursor() as cursor:
- cursor.execute("SELECT Name, MenuName FROM Species "
- "ORDER BY OrderId")
- results = cursor.fetchall()
- return [[name, menu_name] for name, menu_name in results]
-
def get_groups(species, conn):
"""Build groups list"""