Updated the way this is calculated
This commit is contained in:
@@ -45,8 +45,7 @@ export default function ExamList() {
|
|||||||
router.push("/exercises");
|
router.push("/exercises");
|
||||||
};
|
};
|
||||||
|
|
||||||
const getTotalExercises = (module: Module) => {
|
const getTotalExercises = (exam: Exam, module: Module) => {
|
||||||
const exam = exams.find((x) => x.module === module)!;
|
|
||||||
if (exam.module === "reading") {
|
if (exam.module === "reading") {
|
||||||
return exam.parts.flatMap((x) => x.exercises).length;
|
return exam.parts.flatMap((x) => x.exercises).length;
|
||||||
}
|
}
|
||||||
@@ -63,7 +62,7 @@ export default function ExamList() {
|
|||||||
header: "Module",
|
header: "Module",
|
||||||
cell: (info) => <span className={CLASSES[info.getValue()]}>{capitalize(info.getValue())}</span>,
|
cell: (info) => <span className={CLASSES[info.getValue()]}>{capitalize(info.getValue())}</span>,
|
||||||
}),
|
}),
|
||||||
columnHelper.accessor((x) => getTotalExercises(x.module), {
|
columnHelper.accessor((x) => getTotalExercises(x, x.module), {
|
||||||
header: "Exercises",
|
header: "Exercises",
|
||||||
cell: (info) => info.getValue(),
|
cell: (info) => info.getValue(),
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user