ENCOA-315

This commit is contained in:
Carlos-Mesquita
2025-01-22 04:46:24 +00:00
parent 4724e98993
commit e36b24ea3f
12 changed files with 425 additions and 231 deletions

View File

@@ -93,20 +93,11 @@ export const rootReducer = (
};
case 'FINALIZE_MODULE': {
const { updateTimers } = action.payload;
const solutions = state.userSolutions;
const evaluated = state.evaluated;
const hasUnevaluatedSolutions = solutions.some(solution =>
(solution.type === 'speaking' ||
solution.type === 'writing' ||
solution.type === 'interactiveSpeaking') &&
!evaluated.some(evaluation => evaluation.exercise === solution.exercise)
);
// To finalize a module first flag the timers to be updated
if (updateTimers) {
return {
flags: { ...state.flags, finalizeModule: true, pendingEvaluation: hasUnevaluatedSolutions }
flags: { ...state.flags, finalizeModule: true }
}
} else {
// then check whether there are more modules in the exam, if there are
@@ -118,7 +109,6 @@ export const rootReducer = (
...state.flags,
finalizeModule: false,
finalizeExam: true,
pendingEvaluation: hasUnevaluatedSolutions,
}
}
} else if (state.moduleIndex < state.selectedModules.length - 1) {