From 2a68d37de88d45050e4d1be1f040549fd3560a4e Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Thu, 28 Sep 2023 14:51:24 +0100 Subject: [PATCH] Updated the way this is calculated --- src/pages/(admin)/Lists/ExamList.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pages/(admin)/Lists/ExamList.tsx b/src/pages/(admin)/Lists/ExamList.tsx index c850d01d..3ffc1592 100644 --- a/src/pages/(admin)/Lists/ExamList.tsx +++ b/src/pages/(admin)/Lists/ExamList.tsx @@ -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) => {capitalize(info.getValue())}, }), - columnHelper.accessor((x) => getTotalExercises(x.module), { + columnHelper.accessor((x) => getTotalExercises(x, x.module), { header: "Exercises", cell: (info) => info.getValue(), }),