From 047e11c611977814e29f5b636c8583171bf579e3 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 17 Mar 2023 18:27:03 +0000 Subject: Change get_all_species query to order by Family --- gn3/db/species.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gn3/db/species.py') diff --git a/gn3/db/species.py b/gn3/db/species.py index 5b8e096..743e797 100644 --- a/gn3/db/species.py +++ b/gn3/db/species.py @@ -9,8 +9,11 @@ from MySQLdb import escape_string def get_all_species(conn: Any) -> Optional[Tuple]: """Return a list of all species""" with conn.cursor() as cursor: - cursor.execute("SELECT Name, MenuName FROM Species " - "ORDER BY OrderId") + cursor.execute("SELECT Name, MenuName, IFNULL(Family, 'None') " + "FROM Species " + "ORDER BY IFNULL(FamilyOrderId, SpeciesName) ASC, " + "IFNULL(Family, SpeciesName) ASC, " + "OrderId ASC") return cursor.fetchall() -- cgit v1.2.3