Grundlegende Funktion
This commit is contained in:
@@ -41,7 +41,7 @@ def lobby(request, join_code):
|
||||
def create_participant(request, join_code):
|
||||
quiz_game = get_object_or_404(QuizGame, join_code=join_code)
|
||||
|
||||
if "participant_id" in request.COOKIES:
|
||||
if request.method == 'GET' and "participant_id" in request.COOKIES:
|
||||
# Prüfe ob der Teilnehmer noch existiert
|
||||
participant_id = request.COOKIES['participant_id']
|
||||
try:
|
||||
@@ -50,7 +50,7 @@ def create_participant(request, join_code):
|
||||
participant.quiz_game = quiz_game
|
||||
participant.score = 0 # Reset score when joining new game
|
||||
participant.save()
|
||||
return redirect('play:lobby', join_code=join_code)
|
||||
return render(request, 'play/initialize_participant.html', {'participant': participant, 'join_code': quiz_game.join_code})
|
||||
except QuizGameParticipant.DoesNotExist:
|
||||
# Cookie löschen wenn Teilnehmer nicht mehr existiert
|
||||
response = HttpResponseRedirect(request.path)
|
||||
|
||||
Reference in New Issue
Block a user