forked from brmlab/brmbar-github
maybe make something faster
This commit is contained in:
parent
c17aa99666
commit
9afef5bce2
1 changed files with 3 additions and 2 deletions
|
@ -198,12 +198,13 @@ class Shop:
|
||||||
"""list all accounts (people or items, as per acctype)"""
|
"""list all accounts (people or items, as per acctype)"""
|
||||||
accts = []
|
accts = []
|
||||||
cur = self.db.execute_and_fetchall(
|
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],
|
[acctype, like_str],
|
||||||
)
|
)
|
||||||
# FIXME: sanitize input like_str ^
|
# FIXME: sanitize input like_str ^
|
||||||
for inventory in cur:
|
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
|
return accts
|
||||||
|
|
||||||
def fix_inventory(self, item, amount):
|
def fix_inventory(self, item, amount):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue