forked from rDrama/rDrama
fix combined charging
parent
e1d9ab3848
commit
e014d81c67
|
@ -226,17 +226,19 @@ class User(Base):
|
||||||
g.db.query(User).filter(User.id == self.id).update({ User.marseybux: User.marseybux - amount })
|
g.db.query(User).filter(User.id == self.id).update({ User.marseybux: User.marseybux - amount })
|
||||||
succeeded = True
|
succeeded = True
|
||||||
elif currency == 'combined':
|
elif currency == 'combined':
|
||||||
mbux = in_db.marseybux
|
if in_db.marseybux >= amount:
|
||||||
needed_coins = 0
|
subtracted_mbux = amount
|
||||||
|
print(subtracted_mbux, flush=True)
|
||||||
if mbux < amount:
|
subtracted_coins = 0
|
||||||
needed_coins = amount - mbux
|
else:
|
||||||
if in_db.coins < needed_coins:
|
subtracted_mbux = in_db.marseybux
|
||||||
|
subtracted_coins = amount - subtracted_mbux
|
||||||
|
if subtracted_coins > in_db.coins:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
g.db.query(User).filter(User.id == self.id).update({
|
g.db.query(User).filter(User.id == self.id).update({
|
||||||
User.marseybux: User.marseybux - mbux,
|
User.marseybux: User.marseybux - subtracted_mbux,
|
||||||
User.coins: User.coins - needed_coins,
|
User.coins: User.coins - subtracted_coins,
|
||||||
})
|
})
|
||||||
succeeded = True
|
succeeded = True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue