From 22f988f2ad320921fa4f2b106f015a1b8856b18b Mon Sep 17 00:00:00 2001 From: JubaAzul <118773284+JubaAzul@users.noreply.github.com> Date: Wed, 22 Jan 2025 15:28:45 -0500 Subject: [PATCH] =?UTF-8?q?Confusion=20avec=20la=20navigation=20dans=20les?= =?UTF-8?q?=20questions=20=C3=A0=20rythme=20de=20l'enseignant=20Fixes=20#1?= =?UTF-8?q?45?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MultipleChoiceQuestion.tsx | 2 +- .../pages/Teacher/ManageRoom/ManageRoom.tsx | 31 ++++++++++++------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/client/src/components/Questions/MultipleChoiceQuestion/MultipleChoiceQuestion.tsx b/client/src/components/Questions/MultipleChoiceQuestion/MultipleChoiceQuestion.tsx index 32f451a..9c18605 100644 --- a/client/src/components/Questions/MultipleChoiceQuestion/MultipleChoiceQuestion.tsx +++ b/client/src/components/Questions/MultipleChoiceQuestion/MultipleChoiceQuestion.tsx @@ -23,7 +23,7 @@ interface Props { } const MultipleChoiceQuestion: React.FC = (props) => { - + const { questionStem: questionContent, choices, showAnswer, handleOnSubmitAnswer, globalFeedback } = props; const [answer, setAnswer] = useState(); diff --git a/client/src/pages/Teacher/ManageRoom/ManageRoom.tsx b/client/src/pages/Teacher/ManageRoom/ManageRoom.tsx index 7f1d744..9bf2000 100644 --- a/client/src/pages/Teacher/ManageRoom/ManageRoom.tsx +++ b/client/src/pages/Teacher/ManageRoom/ManageRoom.tsx @@ -261,16 +261,15 @@ const ManageRoom: React.FC = () => { webSocketService.nextQuestion(roomName, quizQuestions[nextQuestionIndex]); }; - // const previousQuestion = () => { - // if (!quizQuestions || !currentQuestion || !quiz?.content) return; + const previousQuestion = () => { + if (!quizQuestions || !currentQuestion || !quiz?.content) return; - // const prevQuestionIndex = Number(currentQuestion?.question.id) - 2; // -2 because question.id starts at index 1 + const prevQuestionIndex = Number(currentQuestion?.question.id) - 2; // -2 because question.id starts at index 1 - // if (prevQuestionIndex === undefined || prevQuestionIndex < 0) return; - - // setCurrentQuestion(quizQuestions[prevQuestionIndex]); - // webSocketService.nextQuestion(roomName, quizQuestions[prevQuestionIndex]); - // }; + if (prevQuestionIndex === undefined || prevQuestionIndex < 0) return; + setCurrentQuestion(quizQuestions[prevQuestionIndex]); + webSocketService.nextQuestion(roomName, quizQuestions[prevQuestionIndex]); + }; const initializeQuizQuestion = () => { const quizQuestionArray = quiz?.content; @@ -493,13 +492,23 @@ const ManageRoom: React.FC = () => { {quizMode === 'teacher' && ( +
+
+ +
-
- - )} +
)}