Skip to content

Commit

Permalink
fix: display error on incomplete answer
Browse files Browse the repository at this point in the history
  • Loading branch information
ReidyT committed Sep 12, 2024
1 parent b9aa577 commit 54cf336
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/components/play/multipleChoices/PlayMultipleChoices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,19 @@ const PlayMultipleChoices = ({
computeChoiceState(choice, lastUserAnswer?.choices, showCorrection)
);
const showError =
choiceStates.some(
(state) =>
state === ChoiceState.INCORRECT || state === ChoiceState.MISSING
) &&
showCorrectness &&
!showCorrection;
(showCorrection &&
choiceStates.some(
(state) =>
state === ChoiceState.INCORRECT || state === ChoiceState.MISSING
)) ||
(showCorrectness && !showCorrection);

useEffect(() => {
console.log(
`showError: ${showError}, showCorrectness: ${showCorrectness}, showCorrection: ${showCorrection}`,
choiceStates
);
}, [choiceStates, showCorrection, showCorrectness, showError]);

useEffect(() => {
const answers = choices.map((c, idx) => choiceToAnswer(c, idx));
Expand Down

0 comments on commit 54cf336

Please sign in to comment.