From 9afef5bce272f41dc00e4b1d33cc70bd7cdac6ed Mon Sep 17 00:00:00 2001 From: TMA Date: Sat, 26 Jul 2025 16:57:30 +0200 Subject: [PATCH] maybe make something faster --- brmbar3/brmbar/Shop.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/brmbar3/brmbar/Shop.py b/brmbar3/brmbar/Shop.py index b32f5bb..a2ef1d1 100644 --- a/brmbar3/brmbar/Shop.py +++ b/brmbar3/brmbar/Shop.py @@ -198,12 +198,13 @@ class Shop: """list all accounts (people or items, as per acctype)""" accts = [] cur = self.db.execute_and_fetchall( - "SELECT id FROM accounts WHERE acctype = %s AND name ILIKE %s ORDER BY name ASC", + "SELECT a.id, a.name aname, a.currency, a.acctype, c.name cname FROM accounts a JOIN currencies c ON c.id=a.currency WHERE a.acctype = %s AND a.name ILIKE %s ORDER BY a.name ASC", [acctype, like_str], ) # FIXME: sanitize input like_str ^ for inventory in cur: - accts += [Account.load(self.db, id=inventory[0])] + curr = Currency(db=self.db, id=inventory[2], name=inventory[4]); + accts += [Account(self.db, id=inventory[0], name=inventory[1], currency=curr, acctype=inventory[3])] return accts def fix_inventory(self, item, amount):