Shop.py: python <3.6 compatibility

This commit is contained in:
Dominik Pantůček 2025-07-10 16:54:45 +02:00
parent 597bca87b5
commit cd9b4484c8

View file

@ -28,7 +28,8 @@ class Shop:
# Call the stored procedure for the sale
cost = self.db.execute_and_fetch(
"SELECT public.sell_item(%s, %s, %s, %s, %s)",
[item.id, amount, user.id, self.currency.id, f"BrmBar sale of {amount}x {item.name} to {user.name}"]
[item.id, amount, user.id, self.currency.id,
"BrmBar sale of {0}x {1} to {2}".format(amount, item.name, user.name)]
)[0]#[0]
self.db.commit()
@ -48,7 +49,8 @@ class Shop:
def sell_for_cash(self, item, amount = 1):
cost = self.db.execute_and_fetch(
"SELECT public.sell_item_for_cash(%s, %s, %s, %s, %s)",
[item.id, amount, user.id, self.currency.id, f"BrmBar sale of {amount}x {item.name} for cash"]
[item.id, amount, user.id, self.currency.id,
"BrmBar sale of {0}x {1} for cash".format(amount, item.name)]
)[0]#[0]
self.db.commit()
@ -79,7 +81,7 @@ class Shop:
# Call the stored procedure for undoing a sale
cost = self.db.execute_and_fetch(
"SELECT public.undo_sale_of_item(%s, %s, %s, %s)",
[item.id, amount, user.id, user.currency.id, f"BrmBar sale UNDO of {amount}x {item.name} to {user.name}"]
[item.id, amount, user.id, user.currency.id, "BrmBar sale UNDO of {0}x {1} to {2}".format(amount, item.name, user.name)]
)[0]#[0]
self.db.commit()