Removed the persistence for the Speaking exam for now

This commit is contained in:
Tiago Ribeiro
2024-06-08 10:39:26 +01:00
parent daec246835
commit 9959cf4294
4 changed files with 8 additions and 24 deletions

View File

@@ -20,10 +20,8 @@ interface Props {
}
export default function Speaking({exam, showSolutions = false, onFinish}: Props) {
const [questionIndex, setQuestionIndex] = useState(0);
const [currentQuestionIndex, setCurrentQuestionIndex] = useState(0);
const {userSolutions, setUserSolutions} = useExamStore((state) => state);
const {questionIndex, setQuestionIndex} = useExamStore((state) => state);
const {hasExamEnded, setHasExamEnded} = useExamStore((state) => state);
const {exerciseIndex, setExerciseIndex} = useExamStore((state) => state);
@@ -34,7 +32,6 @@ export default function Speaking({exam, showSolutions = false, onFinish}: Props)
if (solution) {
setUserSolutions([...userSolutions.filter((x) => x.exercise !== solution.exercise), {...solution, module: "speaking", exam: exam.id}]);
}
setQuestionIndex((prev) => prev + currentQuestionIndex);
if (exerciseIndex + 1 < exam.exercises.length) {
setExerciseIndex(exerciseIndex + 1);
@@ -77,7 +74,7 @@ export default function Speaking({exam, showSolutions = false, onFinish}: Props)
<ModuleTitle
label={convertCamelCaseToReadable(exam.exercises[exerciseIndex].type)}
minTimer={exam.minTimer}
exerciseIndex={exerciseIndex + 1 + questionIndex + currentQuestionIndex}
exerciseIndex={exerciseIndex + 1 + questionIndex}
module="speaking"
totalExercises={countExercises(exam.exercises)}
disableTimer={showSolutions}