Solved some issues related to the listening loading

This commit is contained in:
Tiago Ribeiro
2024-02-06 15:24:51 +00:00
parent 4ec439492e
commit 779fb76b8b
3 changed files with 19 additions and 6 deletions

View File

@@ -137,6 +137,8 @@ export default function ExamPage({page}: Props) {
(async () => {
if (selectedModules.length > 0 && exams.length > 0 && moduleIndex < selectedModules.length) {
const nextExam = exams[moduleIndex];
if (partIndex === -1 && nextExam.module !== "listening") setPartIndex(0);
setExam(nextExam ? updateExamWithUserSolutions(nextExam) : undefined);
}
})();
@@ -277,7 +279,8 @@ export default function ExamPage({page}: Props) {
setUserSolutions([...userSolutions.filter((x) => !solutionIds.includes(x.exercise)), ...solutions]);
setModuleIndex(moduleIndex + 1);
setPartIndex(0);
// TODO: Solve the issue for the listening where it should start with -1
setPartIndex(-1);
setExerciseIndex(-1);
setQuestionIndex(0);
};