From 4b3e16df73502c1b4802b6de60f743093351ebc5 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Mon, 10 May 2021 21:01:45 +0300 Subject: 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. --- wqflask/wqflask/api/gen_menu.py | 18 +++--------------- 1 file 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""" -- cgit v1.2.3