1
Fork 0
mirror of https://github.com/wlinator/luminara.git synced 2024-10-02 18:03:12 +00:00

Fix exchange bug

The bug would occur when any balance is '0', the user's balance would reach the fallback and be reset entirely. This is fixed now.
This commit is contained in:
wlinator 2023-06-20 05:37:19 -04:00
parent 5b1eadab86
commit 01fcd838be

View file

@ -38,7 +38,7 @@ class Currency:
query = """
SELECT cash_balance, special_balance
FROM currency
WHERE user_id = ?
WHERE user_id = ?
"""
try:
@ -49,7 +49,7 @@ class Currency:
# if the user doesn't have a balance yet -> create one
# additionally if for some reason a balance becomes Null
# re-generate the user's balance as fallback.
if not cash_balance or not special_balance:
if cash_balance is None or special_balance is None:
query = """
INSERT INTO currency (user_id, cash_balance, special_balance)
VALUES (?, 50, 3)