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