From ea8a3625ef71ebe238887bde5b6ad9c5e61629a8 Mon Sep 17 00:00:00 2001 From: Carlos Mesquita Date: Wed, 28 Aug 2024 13:28:21 +0100 Subject: [PATCH] Patched a bug where the user would be locked out of continuing if he closed the unawnsered modal --- src/exams/Level/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/exams/Level/index.tsx b/src/exams/Level/index.tsx index 60e6bf65..7784829e 100644 --- a/src/exams/Level/index.tsx +++ b/src/exams/Level/index.tsx @@ -129,6 +129,7 @@ export default function Level({ exam, showSolutions = false, onFinish, editing = if (exerciseIndex + 1 < exam.parts[partIndex].exercises.length && !hasExamEnded) { setExerciseIndex(exerciseIndex + 1); + setCurrentSolutionSet(false); return; } @@ -157,6 +158,7 @@ export default function Level({ exam, showSolutions = false, onFinish, editing = setExerciseIndex(0); setQuestionIndex(0); setMultipleChoicesDone((prev) => [...prev.filter((x) => x.id !== currentExercise!.id), { id: currentExercise!.id, amount: currentExercise?.type == "fillBlanks" ? currentExercise.words.length - 1 : questionIndex }]); + setCurrentSolutionSet(false); return; } @@ -166,6 +168,7 @@ export default function Level({ exam, showSolutions = false, onFinish, editing = } setHasExamEnded(false); + setCurrentSolutionSet(false); if (typeof showSolutionsSave !== "undefined") { onFinish(showSolutionsSave); } else { @@ -177,7 +180,6 @@ export default function Level({ exam, showSolutions = false, onFinish, editing = if (nextExerciseCalled && currentSolutionSet) { nextExercise(); setNextExerciseCalled(false); - setCurrentSolutionSet(false); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [nextExerciseCalled, currentSolutionSet])