From 8291a52ba9a5c5d30dcd03b74edf75093fbb57dc Mon Sep 17 00:00:00 2001 From: RaymondVerhoef Date: Mon, 25 May 2026 19:09:17 +0200 Subject: [PATCH] fix test --- src/lib/testService.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lib/testService.js b/src/lib/testService.js index ee5fcbc..35a8965 100644 --- a/src/lib/testService.js +++ b/src/lib/testService.js @@ -207,26 +207,27 @@ export async function generateWeeklyQuiz(userId, weekNumber, force = false) { const questions = []; - const primaryQs = await getOrGenerateTopicQuestions(primaryTopic, 5); + const primaryQs = await getOrGenerateTopicQuestions(primaryTopic, 3); questions.push(...primaryQs); for (const rt of reviewTopics) { + if (questions.length >= 5) break; const rtQs = await getOrGenerateTopicQuestions(rt, 1); questions.push(...rtQs); } - if (questions.length < 10) { - const needed = 10 - questions.length; + if (questions.length < 5) { + const needed = 5 - questions.length; const extraQs = await getOrGenerateTopicQuestions(primaryTopic, needed + 5); const existingIds = new Set(questions.map(q => q.id)); for (const eq of extraQs) { - if (!existingIds.has(eq.id) && questions.length < 10) { + if (!existingIds.has(eq.id) && questions.length < 5) { questions.push(eq); } } } - const shuffled = shuffle(questions); + const shuffled = shuffle(questions).slice(0, 5); const quiz = { questions: shuffled,