aboutsummaryrefslogtreecommitdiff
path: root/gn3/db/species.py
diff options
context:
space:
mode:
authorzsloan2023-03-17 18:27:03 +0000
committerzsloan2023-03-17 18:27:03 +0000
commit047e11c611977814e29f5b636c8583171bf579e3 (patch)
treef62686491db72a48a0b368c0778b93154370162a /gn3/db/species.py
parent47f56fb88604e4f0aa43cf9d75db7570f18ff5f7 (diff)
downloadgenenetwork3-047e11c611977814e29f5b636c8583171bf579e3.tar.gz
Change get_all_species query to order by Family
Diffstat (limited to 'gn3/db/species.py')
-rw-r--r--gn3/db/species.py7
1 files changed, 5 insertions, 2 deletions
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()