aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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()