From: Agnibho Mondal Date: Thu, 11 Jan 2024 19:59:51 +0000 (+0530) Subject: Patient list order by cid X-Git-Url: https://code.agnibho.com/repo?a=commitdiff_plain;h=dcbd2972ea39ef029e6ba9774e804918e9fb1156;p=librevax.git Patient list order by cid --- diff --git a/patient.py b/patient.py index 8286581..267e3bb 100644 --- a/patient.py +++ b/patient.py @@ -46,9 +46,9 @@ def list(cursor, filter={"cid":"%", "name":"%", "next":"%"}, mid=None): try: filter={k:v for k,v in filter.items() if v} if(mid is None): - result=cursor.execute("SELECT * FROM patients WHERE cid LIKE ? AND name LIKE ? AND next LIKE ?", ("%"+filter.get("cid", "")+"%", "%"+filter.get("name", "")+"%", "%"+filter.get("next", "")+"%")) + result=cursor.execute("SELECT * FROM patients WHERE cid LIKE ? AND name LIKE ? AND next LIKE ? ORDER BY cid DESC", ("%"+filter.get("cid", "")+"%", "%"+filter.get("name", "")+"%", "%"+filter.get("next", "")+"%")) else: - result=cursor.execute("SELECT * FROM patients WHERE cid LIKE ? AND name LIKE ? AND next LIKE ? AND mid=?", ("%"+filter.get("cid", "")+"%", "%"+filter.get("name", "")+"%", "%"+filter.get("next", "")+"%", mid)) + result=cursor.execute("SELECT * FROM patients WHERE cid LIKE ? AND name LIKE ? AND next LIKE ? AND mid=? ORDER BY cid DESC", ("%"+filter.get("cid", "")+"%", "%"+filter.get("name", "")+"%", "%"+filter.get("next", "")+"%", mid)) #if(filter=="cid"): # result=cursor.execute("SELECT * FROM patients WHERE cid LIKE ? AND mid LIKE ?", (term, mid)) #elif(filter=="name"):