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