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]);
|
||||
|
||||
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> = (props) => {
|
|||
)}
|
||||
|
||||
{!showAnswer && handleOnSubmitAnswer && (
|
||||
|
||||
<div className="submit-button-container">
|
||||
<Button
|
||||
className='submit-button'
|
||||
variant="contained"
|
||||
|
|
@ -109,6 +109,7 @@ const MultipleChoiceQuestionDisplay: React.FC<Props> = (props) => {
|
|||
Répondre
|
||||
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ const NumericalQuestionDisplay: React.FC<Props> = (props) => {
|
|||
</div>
|
||||
)}
|
||||
{handleOnSubmitAnswer && (
|
||||
<div className="submit-button-container">
|
||||
<Button
|
||||
className='submit-button'
|
||||
variant="contained"
|
||||
|
|
@ -120,6 +121,7 @@ const NumericalQuestionDisplay: React.FC<Props> = (props) => {
|
|||
>
|
||||
Répondre
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ const ShortAnswerQuestionDisplay: React.FC<Props> = (props) => {
|
|||
/>
|
||||
</div>
|
||||
{handleOnSubmitAnswer && (
|
||||
<div className="submit-button-container">
|
||||
<Button
|
||||
className='submit-button'
|
||||
variant="contained"
|
||||
|
|
@ -102,6 +103,7 @@ const ShortAnswerQuestionDisplay: React.FC<Props> = (props) => {
|
|||
>
|
||||
Répondre
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ const TrueFalseQuestionDisplay: React.FC<Props> = (props) => {
|
|||
{showAnswer && (
|
||||
<div>
|
||||
<div className='question-feedback-validation'>
|
||||
{question.isTrue? '✅ Correct! ' : '❌ Incorrect!'}
|
||||
{answer === question.isTrue ? '✅ Correct! ' : '❌ Incorrect!'}
|
||||
</div>
|
||||
<div className="question-title">
|
||||
Question :
|
||||
|
|
@ -104,6 +104,7 @@ const TrueFalseQuestionDisplay: React.FC<Props> = (props) => {
|
|||
</div>
|
||||
)}
|
||||
{!showAnswer && handleOnSubmitAnswer && (
|
||||
<div className="submit-button-container">
|
||||
<Button
|
||||
className='submit-button'
|
||||
variant="contained"
|
||||
|
|
@ -115,6 +116,7 @@ const TrueFalseQuestionDisplay: React.FC<Props> = (props) => {
|
|||
>
|
||||
Répondre
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -214,3 +214,8 @@
|
|||
width: min-content;
|
||||
margin-left: 19rem;}
|
||||
|
||||
.submit-button-container{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
Loading…
Reference in a new issue