From d1a547cfe5e449928ba09d407726bf88771b4d2a Mon Sep 17 00:00:00 2001 From: abullockuno Date: Thu, 16 Dec 2021 15:06:51 -0600 Subject: [PATCH] fixes init --- project/yahtzee/frontend/views.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/project/yahtzee/frontend/views.py b/project/yahtzee/frontend/views.py index 33e5545e..a238a4f2 100644 --- a/project/yahtzee/frontend/views.py +++ b/project/yahtzee/frontend/views.py @@ -15,7 +15,7 @@ def index(request): context = {} permissions = request.user.has_perm('perms.game.can_delete') nameValuePair1 = {'Name':'is_authenticated', 'Value': is_authenticated } - nameValuePair2 = {'Name':'is_game_admin', 'Value': is_game_admin } + nameValuePair2 = {'Name':'is_game_admin', 'Value': is_game_admin } context['is_game_admin'] = is_game_admin return render(request, 'index.html', context) @@ -177,10 +177,9 @@ def gameSetup(request, choice): player_hand = Hand.objects.get(game=hosted_game, player=request.user) except Hand.DoesNotExist: player_hand = Hand(game=hosted_game, player=request.user) - player_hand.save() + player_hand.init() finally: hand = player_hand - hand.init() game.players.add(hand) # Pull associated scoreboard try: @@ -205,9 +204,8 @@ def join(request, gameid): hand = Hand.objects.get(game=game, player=request.user) except Hand.DoesNotExist: hand = Hand(game=game, player=request.user) - hand.save() - hand.init() - hand.save() + hand.init() + game.players.add(hand) try: score = Score.objects.get(game=game, player=request.user)