May have solved a bug made in the writing and speaking evaluation
This commit is contained in:
@@ -46,6 +46,9 @@ export default function ExamPage({page}: Props) {
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => setSessionId(uuidv4()), []);
|
||||
useEffect(() => {
|
||||
console.log({userSolutions});
|
||||
}, [userSolutions]);
|
||||
|
||||
useEffect(() => {
|
||||
selectedModules.length > 0 && timeSpent === 0 && !showSolutions;
|
||||
@@ -134,24 +137,22 @@ export default function ExamPage({page}: Props) {
|
||||
|
||||
Promise.all(
|
||||
exam.exercises.map(async (exercise) => {
|
||||
if (exercise.type === "writing")
|
||||
return evaluateWritingAnswer(exercise, solutions.find((x) => x.exercise === exercise.id)!).then((response) => {
|
||||
if (response) {
|
||||
setUserSolutions([...userSolutions.filter((x) => x.exercise !== exercise.id), response]);
|
||||
}
|
||||
});
|
||||
if (exercise.type === "writing") {
|
||||
return await evaluateWritingAnswer(exercise, solutions.find((x) => x.exercise === exercise.id)!);
|
||||
}
|
||||
|
||||
if (exercise.type === "interactiveSpeaking" || exercise.type === "speaking")
|
||||
return evaluateSpeakingAnswer(exercise, solutions.find((x) => x.exercise === exercise.id)!).then((response) => {
|
||||
if (response) {
|
||||
setUserSolutions([...userSolutions.filter((x) => x.exercise !== exercise.id), response]);
|
||||
}
|
||||
});
|
||||
if (exercise.type === "interactiveSpeaking" || exercise.type === "speaking") {
|
||||
return await evaluateSpeakingAnswer(exercise, solutions.find((x) => x.exercise === exercise.id)!);
|
||||
}
|
||||
}),
|
||||
).finally(() => {
|
||||
setIsEvaluationLoading(false);
|
||||
setHasBeenUploaded(false);
|
||||
});
|
||||
)
|
||||
.then((responses) => {
|
||||
setUserSolutions([...userSolutions, ...responses.filter((x) => !!x)] as any);
|
||||
})
|
||||
.finally(() => {
|
||||
setIsEvaluationLoading(false);
|
||||
setHasBeenUploaded(false);
|
||||
});
|
||||
}
|
||||
|
||||
axios.get("/api/stats/update");
|
||||
|
||||
Reference in New Issue
Block a user