From c89dced20b20f9bbb2110000c4ab49ae4fdb3b94 Mon Sep 17 00:00:00 2001 From: FabrizioCostaMedich Date: Tue, 17 Dec 2024 15:01:35 +0100 Subject: [PATCH] fix(exams): when an exam has the null examStartsAt field, no exams were displayed --- src/core/queries/examHooks.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/queries/examHooks.ts b/src/core/queries/examHooks.ts index 075e3ec9..e5761027 100644 --- a/src/core/queries/examHooks.ts +++ b/src/core/queries/examHooks.ts @@ -29,8 +29,12 @@ export const useGetExams = () => { .then(exams => exams .map(mapApiExamToExam) - .sort( - (a, b) => a.examStartsAt!.valueOf() - b.examStartsAt!.valueOf(), + .sort((a, b) => + !a.examStartsAt + ? 1 + : !b.examStartsAt + ? -1 + : a.examStartsAt.valueOf() - b.examStartsAt.valueOf(), ), ), );