fix
This commit is contained in:
@@ -94,11 +94,15 @@ async function selectTestTopics(userId, isoWeekNumber) {
|
||||
const weekContent = await getCurrentWeekContent(isoWeekNumber);
|
||||
|
||||
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];
|
||||
if (!primaryTopic?.id) {
|
||||
console.warn('[Test] First curriculum topic has no id — falling back to hash');
|
||||
} 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) {
|
||||
console.warn('[Test] Curriculum lookup failed, falling back to hash:', e.message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user