Skip to content

Commit

Permalink
Fixed bank subtraction bug
Browse files Browse the repository at this point in the history
  • Loading branch information
combe15 committed Aug 9, 2021
1 parent 8a62ee7 commit aae0371
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/bank.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __balance__(self) -> float:
SELECT opening_balance, transaction_amount
FROM bank
WHERE author_id = {self.user.id}
ORDER BY timestamp
ORDER BY id DESC
LIMIT 1
"""
result = db.query(statement)
Expand Down Expand Up @@ -105,7 +105,7 @@ def subtract(self, amount: float, reason: str = "") -> "Bank":
if amount == 0: # Pointless, do nothing.
return 0

self.__record_ledger__(amount, reason)
self.__record_ledger__(-amount, reason)
self.balance -= amount
return self

Expand Down

0 comments on commit aae0371

Please sign in to comment.