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:
parent
5b1eadab86
commit
01fcd838be
1 changed files with 2 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue