Fixed bug introduced by "Another game" feature where starting a fresh game would fail.

pull/21/head
Daniel Perelman 7 years ago
parent fcbe0fb220
commit bd810077b2

@ -54,9 +54,14 @@ class JoinGameForm(forms.Form):
cleaned_data["player"] = None
return
if game.previous_game is not None:
previous_game = None
try:
previous_game = game.previous_game
except Game.DoesNotExist:
pass
if previous_game is not None:
try:
player = Player.objects.get(game=game.previous_game, name=name)
player = Player.objects.get(game=previous_game, name=name)
if not player.is_expired():
self.add_error('player', "Please choose a different name; there is already a player using that name.")
self.add_error('player', "Please try again in a few seconds if you are trying to rejoin.")

Loading…
Cancel
Save