From 487383243776f0d8bb64ead3f5abe390439a5c16 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Wed, 27 Sep 2023 09:58:53 +0100 Subject: [PATCH] Solved a bug on repeated questions --- src/pages/api/exam/[module]/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/api/exam/[module]/index.ts b/src/pages/api/exam/[module]/index.ts index 896f079d..820cab53 100644 --- a/src/pages/api/exam/[module]/index.ts +++ b/src/pages/api/exam/[module]/index.ts @@ -37,7 +37,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { const statsSnapshot = await getDocs(statsQ); const stats: Stat[] = statsSnapshot.docs.map((doc) => ({id: doc.id, ...doc.data()})) as unknown as Stat[]; - const filteredExams = exams.filter((x) => stats.map((s) => s.exam).includes(x.id)); + const filteredExams = exams.filter((x) => !stats.map((s) => s.exam).includes(x.id)); res.status(200).json(filteredExams.length > 0 ? filteredExams : exams); return;