mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
[FEATURE] Ajout des rétroactions pour les questions à choix multiples et réponses courtes
Fixes #291
This commit is contained in:
parent
33d81ac604
commit
8bf28e725b
5 changed files with 15 additions and 3 deletions
|
|
@ -35,7 +35,7 @@ const MultipleChoiceQuestionDisplay: React.FC<Props> = (props) => {
|
||||||
}, [answer]);
|
}, [answer]);
|
||||||
|
|
||||||
const checkAnswer = () => {
|
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);
|
setisGoodAnswer(isCorrect);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -97,7 +97,7 @@ const MultipleChoiceQuestionDisplay: React.FC<Props> = (props) => {
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!showAnswer && handleOnSubmitAnswer && (
|
{!showAnswer && handleOnSubmitAnswer && (
|
||||||
|
<div className="submit-button-container">
|
||||||
<Button
|
<Button
|
||||||
className='submit-button'
|
className='submit-button'
|
||||||
variant="contained"
|
variant="contained"
|
||||||
|
|
@ -109,6 +109,7 @@ const MultipleChoiceQuestionDisplay: React.FC<Props> = (props) => {
|
||||||
Répondre
|
Répondre
|
||||||
|
|
||||||
</Button>
|
</Button>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@ const NumericalQuestionDisplay: React.FC<Props> = (props) => {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{handleOnSubmitAnswer && (
|
{handleOnSubmitAnswer && (
|
||||||
|
<div className="submit-button-container">
|
||||||
<Button
|
<Button
|
||||||
className='submit-button'
|
className='submit-button'
|
||||||
variant="contained"
|
variant="contained"
|
||||||
|
|
@ -120,6 +121,7 @@ const NumericalQuestionDisplay: React.FC<Props> = (props) => {
|
||||||
>
|
>
|
||||||
Répondre
|
Répondre
|
||||||
</Button>
|
</Button>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ const ShortAnswerQuestionDisplay: React.FC<Props> = (props) => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{handleOnSubmitAnswer && (
|
{handleOnSubmitAnswer && (
|
||||||
|
<div className="submit-button-container">
|
||||||
<Button
|
<Button
|
||||||
className='submit-button'
|
className='submit-button'
|
||||||
variant="contained"
|
variant="contained"
|
||||||
|
|
@ -102,6 +103,7 @@ const ShortAnswerQuestionDisplay: React.FC<Props> = (props) => {
|
||||||
>
|
>
|
||||||
Répondre
|
Répondre
|
||||||
</Button>
|
</Button>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ const TrueFalseQuestionDisplay: React.FC<Props> = (props) => {
|
||||||
{showAnswer && (
|
{showAnswer && (
|
||||||
<div>
|
<div>
|
||||||
<div className='question-feedback-validation'>
|
<div className='question-feedback-validation'>
|
||||||
{question.isTrue? '✅ Correct! ' : '❌ Incorrect!'}
|
{answer === question.isTrue ? '✅ Correct! ' : '❌ Incorrect!'}
|
||||||
</div>
|
</div>
|
||||||
<div className="question-title">
|
<div className="question-title">
|
||||||
Question :
|
Question :
|
||||||
|
|
@ -104,6 +104,7 @@ const TrueFalseQuestionDisplay: React.FC<Props> = (props) => {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{!showAnswer && handleOnSubmitAnswer && (
|
{!showAnswer && handleOnSubmitAnswer && (
|
||||||
|
<div className="submit-button-container">
|
||||||
<Button
|
<Button
|
||||||
className='submit-button'
|
className='submit-button'
|
||||||
variant="contained"
|
variant="contained"
|
||||||
|
|
@ -115,6 +116,7 @@ const TrueFalseQuestionDisplay: React.FC<Props> = (props) => {
|
||||||
>
|
>
|
||||||
Répondre
|
Répondre
|
||||||
</Button>
|
</Button>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -214,3 +214,8 @@
|
||||||
width: min-content;
|
width: min-content;
|
||||||
margin-left: 19rem;}
|
margin-left: 19rem;}
|
||||||
|
|
||||||
|
.submit-button-container{
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue