From 77714d22a9c0a7893b00f9f991f68a0c90e6c2cc Mon Sep 17 00:00:00 2001 From: ben8 Date: Thu, 10 Apr 2025 14:43:43 +0200 Subject: [PATCH] Zeit_bisher_im_Backend #76 --- django/library/forms.py | 2 +- django/play/views.py | 2 ++ django/templates/play/game/question_host.html | 2 +- django/templates/play/game/question_participant.html | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/django/library/forms.py b/django/library/forms.py index b5ab887..1a5ad63 100644 --- a/django/library/forms.py +++ b/django/library/forms.py @@ -9,7 +9,7 @@ class QuizForm(forms.ModelForm): class QuestionForm(forms.ModelForm): class Meta: model = QivipQuestion - fields = ['quiz_id', 'data', 'time_per_question'] + fields = ['quiz_id', 'data','time_per_question'] from django import forms diff --git a/django/play/views.py b/django/play/views.py index 6887cc0..82991d6 100644 --- a/django/play/views.py +++ b/django/play/views.py @@ -210,6 +210,7 @@ def question(request, join_code): return render(request, 'play/game/question_host.html', { 'quiz_game': quiz_game, 'question_data': question_data, + 'current_question':current_question, 'host_id': quiz_game.host_id, 'start_time': int(quiz_game.question_start_time.timestamp() * 1000), 'question_index': quiz_game.current_question_index, @@ -229,6 +230,7 @@ def question(request, join_code): return render(request, 'play/game/question_participant.html', { 'quiz_game': quiz_game, 'question_data': question_data, + 'current_question':current_question, 'participant': participant, 'start_time': int(quiz_game.question_start_time.timestamp() * 1000), 'question_index': quiz_game.current_question_index, diff --git a/django/templates/play/game/question_host.html b/django/templates/play/game/question_host.html index 7a4f17c..84f1d7f 100644 --- a/django/templates/play/game/question_host.html +++ b/django/templates/play/game/question_host.html @@ -35,7 +35,7 @@ const joinCode = '{{ quiz_game.join_code }}'; const hostId = '{{ host_id }}'; const questionStartTime = {{ start_time }}; - const questionDuration = 30000; // 30 seconds in milliseconds + const questionDuration = '{{ current_question.time_per_question }}'*1000; //Zeit pro Frage (indviduell eingestellt) const gameSocket = initializeGameSocket(joinCode); let answeredParticipants = 0; let totalParticipants = 0; diff --git a/django/templates/play/game/question_participant.html b/django/templates/play/game/question_participant.html index 2caf10d..2800f35 100644 --- a/django/templates/play/game/question_participant.html +++ b/django/templates/play/game/question_participant.html @@ -37,7 +37,7 @@ const joinCode = '{{ quiz_game.join_code }}'; const participantId = '{{ participant.participant_id }}'; const questionStartTime = {{ start_time }}; - const questionDuration = 30000; // 30 seconds in milliseconds + const questionDuration = '{{ current_question.time_per_question }}'*1000; //Zeit pro Frage (indviduell eingestellt) const gameSocket = initializeGameSocket(joinCode); gameSocket.onmessage = function(e) {