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,