forked from MarseyWorld/MarseyWorld
fix blackjack when hitting blackjack
parent
970cf6dccd
commit
11b391c437
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
@ -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 }}
|
||||
|
|
Loading…
Reference in New Issue