Fixed a bug with the module evaluation, no idea why it was happening

This commit is contained in:
Tiago Ribeiro
2024-02-14 11:19:55 +00:00
parent 764064bc28
commit 44c61c2e5d
2 changed files with 10 additions and 7 deletions

View File

@@ -336,12 +336,13 @@ export default function ExamPage({page}: Props) {
};
answers.forEach((x) => {
console.log({x});
const examModule =
x.module || (x.type === "writing" ? "writing" : x.type === "speaking" || x.type === "interactiveSpeaking" ? "speaking" : undefined);
scores[x.module!] = {
total: scores[x.module!].total + x.score.total,
correct: scores[x.module!].correct + x.score.correct,
missing: scores[x.module!].missing + x.score.missing,
scores[examModule!] = {
total: scores[examModule!].total + x.score.total,
correct: scores[examModule!].correct + x.score.correct,
missing: scores[examModule!].missing + x.score.missing,
};
});