From b306d113adab4b44ef5578136c72677f03d1f9b1 Mon Sep 17 00:00:00 2001 From: TLSM Date: Fri, 3 Jun 2022 02:24:32 -0400 Subject: [PATCH] Lottery: Fix treasure adding coins to manager. It was observed in prod that the lottery prize as tracked by the DB had diverged from the amount held in the Lottershe manager account. This appears to be the result of grant_lottery_tickets_to_user adding the # of _tickets_ rather than the value of those tickets to the manager. --- files/helpers/lottery.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/helpers/lottery.py b/files/helpers/lottery.py index 9468384bd..9ce9138ce 100644 --- a/files/helpers/lottery.py +++ b/files/helpers/lottery.py @@ -100,11 +100,11 @@ def purchase_lottery_tickets(v, quantity=1): return True, f'Successfully purchased {quantity} lottery tickets!' -def grant_lottery_proceeds_to_manager(amount): +def grant_lottery_proceeds_to_manager(prize_value): manager = g.db.query(User).get(LOTTERY_MANAGER_ACCOUNT_ID) if manager: - manager.coins += amount + manager.coins += prize_value def grant_lottery_tickets_to_user(v, amount): active_lottery = get_active_lottery() @@ -117,6 +117,6 @@ def grant_lottery_tickets_to_user(v, amount): active_lottery.prize += prize_value active_lottery.tickets_sold += amount - grant_lottery_proceeds_to_manager(amount) + grant_lottery_proceeds_to_manager(prize_value) g.db.commit() \ No newline at end of file