forked from MarseyWorld/MarseyWorld
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
parent
3dc9027f7c
commit
b306d113ad
|
@ -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()
|
Loading…
Reference in New Issue