forked from brmlab/brmbar-github
Ensure amount in buy_for_cash is integer.
This commit is contained in:
parent
be0b50fedd
commit
f962586e3a
1 changed files with 4 additions and 1 deletions
|
@ -126,9 +126,12 @@ class Shop:
|
|||
#self.withdraw_credit(amount, userfrom)
|
||||
|
||||
def buy_for_cash(self, item, amount = 1):
|
||||
iamount = int(amount)
|
||||
famount = float(iamount)
|
||||
assert famount == amount, "amount is not integer value %s".format(amount)
|
||||
cost = self.db.execute_and_fetch(
|
||||
"SELECT public.buy_for_cash(%s, %s, %s, %s, %s)",
|
||||
[self.cash.id, item.id, amount, self.currency.id, item.name]
|
||||
[self.cash.id, item.id, iamount, self.currency.id, item.name]
|
||||
)[0]
|
||||
# Buy: Currency conversion from item currency to shop currency
|
||||
#(buy, sell) = item.currency.rates(self.currency)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue