Fixed some navigation issues and updated Listening

This commit is contained in:
Carlos-Mesquita
2024-11-26 14:33:49 +00:00
parent de08164dd8
commit 1fc439cb25
15 changed files with 183 additions and 480 deletions

View File

@@ -111,7 +111,17 @@ export const rootReducer = (
} else {
// then check whether there are more modules in the exam, if there are
// setup the next module
if (state.moduleIndex + 1 < state.selectedModules.length) {
if (state.moduleIndex === state.selectedModules.length - 1) {
return {
showSolutions: true,
flags: {
...state.flags,
finalizeModule: false,
finalizeExam: true,
pendingEvaluation: hasUnevaluatedSolutions,
}
}
} else if (state.moduleIndex < state.selectedModules.length - 1) {
return {
moduleIndex: state.moduleIndex + 1,
partIndex: 0,
@@ -123,27 +133,14 @@ export const rootReducer = (
finalizeModule: false,
}
}
} else {
// if there are no modules left, flag finalizeExam
// so that the stats are uploaded in ExamPage
// and the Finish view is set there, no need to
// dispatch another init
return {
showSolutions: true,
flags: {
...state.flags,
finalizeModule: false,
finalizeExam: true,
pendingEvaluation: hasUnevaluatedSolutions,
}
}
}
}
}
case 'FINALIZE_MODULE_SOLUTIONS': {
if (state.flags.reviewAll) {
const notLastModule = state.moduleIndex < state.selectedModules.length;
const notLastModule = state.moduleIndex < state.selectedModules.length - 1;
const moduleIndex = notLastModule ? state.moduleIndex + 1 : -1;
if (notLastModule) {
return {
questionIndex: 0,
@@ -160,12 +157,12 @@ export const rootReducer = (
moduleIndex: -1
}
}
} else {
return {
moduleIndex: -1
}
}
}
case 'UPDATE_EXAMS': {
const exams = state.exams.map((e) => updateExamWithUserSolutions(e, state.userSolutions));