This commit is contained in:
RaymondVerhoef
2026-05-25 19:41:20 +02:00
parent b24ddc5490
commit 7d1fe83f72

View File

@@ -94,10 +94,14 @@ async function selectTestTopics(userId, isoWeekNumber) {
const weekContent = await getCurrentWeekContent(isoWeekNumber); const weekContent = await getCurrentWeekContent(isoWeekNumber);
if (weekContent && weekContent.topics && weekContent.topics.length > 0) { if (weekContent && weekContent.topics && weekContent.topics.length > 0) {
const primaryTopic = weekContent.topics[0]; // Use first topic as primary for now const primaryTopic = weekContent.topics[0];
const others = topics.filter(t => t.id !== primaryTopic.id); if (!primaryTopic?.id) {
const reviewTopics = sample(others, Math.min(5, others.length)); console.warn('[Test] First curriculum topic has no id — falling back to hash');
return { primaryTopic, reviewTopics, isReviewWeek: false }; } else {
const others = topics.filter(t => t.id !== primaryTopic.id);
const reviewTopics = sample(others, Math.min(5, others.length));
return { primaryTopic, reviewTopics, isReviewWeek: false };
}
} }
} catch (e) { } catch (e) {
console.warn('[Test] Curriculum lookup failed, falling back to hash:', e.message); console.warn('[Test] Curriculum lookup failed, falling back to hash:', e.message);