Quiz Instanz von Teilnehmer updaten, wenn dieser einem anderen Quiz beitritt
This commit is contained in:
@@ -8,10 +8,13 @@ from django.http import HttpResponseRedirect
|
|||||||
def lobby(request, join_code):
|
def lobby(request, join_code):
|
||||||
if not "participant_id" in request.COOKIES:
|
if not "participant_id" in request.COOKIES:
|
||||||
return redirect('play:create_participant', join_code=join_code)
|
return redirect('play:create_participant', join_code=join_code)
|
||||||
|
|
||||||
participant_id = request.COOKIES['participant_id']
|
participant_id = request.COOKIES['participant_id']
|
||||||
quiz_game = get_object_or_404(QuizGame, join_code=join_code)
|
quiz_game = get_object_or_404(QuizGame, join_code=join_code)
|
||||||
participant = get_object_or_404(QuizGameParticipant, participant_id=participant_id)
|
participant = get_object_or_404(QuizGameParticipant, participant_id=participant_id)
|
||||||
|
|
||||||
|
if not participant.quiz_game.join_code == join_code:
|
||||||
|
participant.quiz_game = quiz_game
|
||||||
|
participant.save()
|
||||||
return render(request, 'play/lobby.html', {'debug': "test", 'participant': participant})
|
return render(request, 'play/lobby.html', {'debug': "test", 'participant': participant})
|
||||||
|
|
||||||
def create_participant(request, join_code):
|
def create_participant(request, join_code):
|
||||||
|
|||||||
Reference in New Issue
Block a user