Updated the Listening format to work

This commit is contained in:
Tiago Ribeiro
2023-09-29 13:56:11 +01:00
parent 2a68d37de8
commit 782976c14f
6 changed files with 57 additions and 23 deletions

View File

@@ -45,8 +45,8 @@ export default function ExamList() {
router.push("/exercises");
};
const getTotalExercises = (exam: Exam, module: Module) => {
if (exam.module === "reading") {
const getTotalExercises = (exam: Exam) => {
if (exam.module === "reading" || exam.module === "listening") {
return exam.parts.flatMap((x) => x.exercises).length;
}
@@ -62,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, x.module), {
columnHelper.accessor((x) => getTotalExercises(x), {
header: "Exercises",
cell: (info) => info.getValue(),
}),