From 3585f06acdb7b5a80483366913fcfd0ad816be85 Mon Sep 17 00:00:00 2001 From: Chris kerr Date: Mon, 5 Feb 2024 20:34:36 -0500 Subject: [PATCH] monsters listed in ascending order of potential --- app.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index f4d05bf..886ceec 100644 --- a/app.py +++ b/app.py @@ -61,13 +61,21 @@ def json_monsters(): if selected_family: cursor.execute( """ - SELECT name FROM monsters + SELECT name + FROM monsters WHERE family_id = (SELECT id FROM families WHERE name = ?) + ORDER BY (agl + int + atk + mp + exp + hp + def) * maxlvl ASC """, (selected_family,), ) else: - cursor.execute("SELECT DISTINCT name FROM monsters") + cursor.execute( + """ + SELECT name + FROM monsters + ORDER BY (agl + int + atk + mp + exp + hp + def) * maxlvl ASC + """ + ) monsters = [row[0] for row in cursor.fetchall()] return jsonify(monsters)