Patched a bug where the user would be locked out of continuing if he closed the unawnsered modal

This commit is contained in:
Carlos Mesquita
2024-08-28 13:28:21 +01:00
parent ef32226c6c
commit ea8a3625ef

View File

@@ -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])