From 8bf28e725b0833fe466b96c029c8af21bf1f778f Mon Sep 17 00:00:00 2001 From: JubaAzul <118773284+JubaAzul@users.noreply.github.com> Date: Mon, 17 Mar 2025 14:44:39 -0400 Subject: [PATCH] =?UTF-8?q?[FEATURE]=20Ajout=20des=20r=C3=A9troactions=20p?= =?UTF-8?q?our=20les=20questions=20=C3=A0=20choix=20multiples=20et=20r?= =?UTF-8?q?=C3=A9ponses=20courtes=20Fixes=20#291?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MultipleChoiceQuestionDisplay.tsx | 5 +++-- .../NumericalQuestionDisplay/NumericalQuestionDisplay.tsx | 2 ++ .../ShortAnswerQuestionDisplay.tsx | 2 ++ .../TrueFalseQuestionDisplay/TrueFalseQuestionDisplay.tsx | 4 +++- client/src/components/QuestionsDisplay/questionStyle.css | 5 +++++ 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/client/src/components/QuestionsDisplay/MultipleChoiceQuestionDisplay/MultipleChoiceQuestionDisplay.tsx b/client/src/components/QuestionsDisplay/MultipleChoiceQuestionDisplay/MultipleChoiceQuestionDisplay.tsx index 1a3152d..fffae6c 100644 --- a/client/src/components/QuestionsDisplay/MultipleChoiceQuestionDisplay/MultipleChoiceQuestionDisplay.tsx +++ b/client/src/components/QuestionsDisplay/MultipleChoiceQuestionDisplay/MultipleChoiceQuestionDisplay.tsx @@ -35,7 +35,7 @@ const MultipleChoiceQuestionDisplay: React.FC = (props) => { }, [answer]); const checkAnswer = () => { - const isCorrect = question.choices.some((choice) => choice.formattedText.text === answer as string); + const isCorrect = question.choices.some((choice) => choice.isCorrect && choice.formattedText.text === answer as string); setisGoodAnswer(isCorrect); }; @@ -97,7 +97,7 @@ const MultipleChoiceQuestionDisplay: React.FC = (props) => { )} {!showAnswer && handleOnSubmitAnswer && ( - +
+
)} ); diff --git a/client/src/components/QuestionsDisplay/NumericalQuestionDisplay/NumericalQuestionDisplay.tsx b/client/src/components/QuestionsDisplay/NumericalQuestionDisplay/NumericalQuestionDisplay.tsx index d9026cf..b6fc138 100644 --- a/client/src/components/QuestionsDisplay/NumericalQuestionDisplay/NumericalQuestionDisplay.tsx +++ b/client/src/components/QuestionsDisplay/NumericalQuestionDisplay/NumericalQuestionDisplay.tsx @@ -108,6 +108,7 @@ const NumericalQuestionDisplay: React.FC = (props) => { )} {handleOnSubmitAnswer && ( +
+
)} )} diff --git a/client/src/components/QuestionsDisplay/ShortAnswerQuestionDisplay/ShortAnswerQuestionDisplay.tsx b/client/src/components/QuestionsDisplay/ShortAnswerQuestionDisplay/ShortAnswerQuestionDisplay.tsx index fd49835..d03720c 100644 --- a/client/src/components/QuestionsDisplay/ShortAnswerQuestionDisplay/ShortAnswerQuestionDisplay.tsx +++ b/client/src/components/QuestionsDisplay/ShortAnswerQuestionDisplay/ShortAnswerQuestionDisplay.tsx @@ -90,6 +90,7 @@ const ShortAnswerQuestionDisplay: React.FC = (props) => { /> {handleOnSubmitAnswer && ( +
+
)} )} diff --git a/client/src/components/QuestionsDisplay/TrueFalseQuestionDisplay/TrueFalseQuestionDisplay.tsx b/client/src/components/QuestionsDisplay/TrueFalseQuestionDisplay/TrueFalseQuestionDisplay.tsx index a8d4acf..808185b 100644 --- a/client/src/components/QuestionsDisplay/TrueFalseQuestionDisplay/TrueFalseQuestionDisplay.tsx +++ b/client/src/components/QuestionsDisplay/TrueFalseQuestionDisplay/TrueFalseQuestionDisplay.tsx @@ -51,7 +51,7 @@ const TrueFalseQuestionDisplay: React.FC = (props) => { {showAnswer && (
- {question.isTrue? '✅ Correct! ' : '❌ Incorrect!'} + {answer === question.isTrue ? '✅ Correct! ' : '❌ Incorrect!'}
Question : @@ -104,6 +104,7 @@ const TrueFalseQuestionDisplay: React.FC = (props) => {
)} {!showAnswer && handleOnSubmitAnswer && ( +
+
)}
); diff --git a/client/src/components/QuestionsDisplay/questionStyle.css b/client/src/components/QuestionsDisplay/questionStyle.css index ddd6416..328c1ed 100644 --- a/client/src/components/QuestionsDisplay/questionStyle.css +++ b/client/src/components/QuestionsDisplay/questionStyle.css @@ -214,3 +214,8 @@ width: min-content; margin-left: 19rem;} +.submit-button-container{ + display: flex; + justify-content: center; + margin-top: 1rem; +} \ No newline at end of file