fix blackjack when hitting blackjack

master
Aevann1 2022-09-05 04:34:30 +02:00
parent 970cf6dccd
commit 11b391c437
2 changed files with 5 additions and 2 deletions

View File

@ -51,7 +51,7 @@ def get_active_game(gambler):
game = g.db.query(Casino_Game) \
.filter(Casino_Game.active == True,
Casino_Game.kind == 'blackjack',
Casino_Game.user_id == gambler.id).first()
Casino_Game.user_id == gambler.id).one_or_none()
if game:
return game, json.loads(game.game_state)
@ -95,7 +95,8 @@ def apply_blackjack_result(gambler):
gambler.winnings += reward
game.winnings += reward
game.active = False
if result not in ('push','blackjack'):
game.active = False
g.db.add(game)

View File

@ -79,6 +79,8 @@ def deal_blackjack(v):
if game and game.active:
safe_state = get_safe_game_state(v)
if safe_state['status'] in ('push','blackjack'):
game.active = False
return {"game_state": safe_state, "gambler": { "coins": v.coins, "procoins": v.procoins }}
else:
return {"game_state": game_state, "gambler": { "coins": v.coins, "procoins": v.procoins }}