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.
master
Snakes 2022-06-03 02:24:32 -04:00
parent 3dc9027f7c
commit b306d113ad
1 changed files with 3 additions and 3 deletions

View File

@ -100,11 +100,11 @@ def purchase_lottery_tickets(v, quantity=1):
return True, f'Successfully purchased {quantity} lottery tickets!' 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) manager = g.db.query(User).get(LOTTERY_MANAGER_ACCOUNT_ID)
if manager: if manager:
manager.coins += amount manager.coins += prize_value
def grant_lottery_tickets_to_user(v, amount): def grant_lottery_tickets_to_user(v, amount):
active_lottery = get_active_lottery() active_lottery = get_active_lottery()
@ -117,6 +117,6 @@ def grant_lottery_tickets_to_user(v, amount):
active_lottery.prize += prize_value active_lottery.prize += prize_value
active_lottery.tickets_sold += amount active_lottery.tickets_sold += amount
grant_lottery_proceeds_to_manager(amount) grant_lottery_proceeds_to_manager(prize_value)
g.db.commit() g.db.commit()