diff --git a/src/components/admin/CurriculumManager.jsx b/src/components/admin/CurriculumManager.jsx index 8a8029e..77217a4 100644 --- a/src/components/admin/CurriculumManager.jsx +++ b/src/components/admin/CurriculumManager.jsx @@ -44,7 +44,7 @@ const CurriculumManager = () => { db.getTopics(), ]); setCurriculum(currData); - setTopics(topicData.filter(t => t.type !== 'fact')); + setTopics(topicData.filter(t => t.type !== 'fact' && t.learning_relevance !== 'exclude')); setIsLoading(false); }; diff --git a/src/lib/curriculumService.js b/src/lib/curriculumService.js index 2e57ad0..2d1fa76 100644 --- a/src/lib/curriculumService.js +++ b/src/lib/curriculumService.js @@ -87,9 +87,9 @@ export async function getCurriculumTopic(weekNumber, year) { return { topic: null, curriculumEntry: entry || null }; } - // Resolve the topic from the topics collection + // Resolve the topic from the topics collection (ensure it is not excluded) const topics = await db.getTopics(); - const topic = topics.find(t => t.id === entry.topic_id) || null; + const topic = topics.find(t => t.id === entry.topic_id && t.learning_relevance !== 'exclude') || null; return { topic, curriculumEntry: entry }; } @@ -178,8 +178,8 @@ export async function autoGenerateCurriculum(year) { const currYear = year ?? getCurriculumYear(); const topics = await db.getTopics(); - // Filter out 'fact' type topics — those are for the knowledge graph only - const learningTopics = topics.filter(t => t.type !== 'fact'); + // Filter out 'fact' type topics and 'exclude' relevance topics + const learningTopics = topics.filter(t => t.type !== 'fact' && t.learning_relevance !== 'exclude'); const weeks = []; const reviewWeeks = [13, 26, 39, 52]; diff --git a/src/lib/learningService.js b/src/lib/learningService.js index 2de2341..520a7a8 100644 --- a/src/lib/learningService.js +++ b/src/lib/learningService.js @@ -56,13 +56,15 @@ export async function getAssignedTopic(userId, weekNumber) { // Try curriculum first try { const { topic } = await getCurriculumTopic(weekNumber); - if (topic) return topic; + if (topic && topic.learning_relevance !== 'exclude') return topic; } catch (e) { console.warn('[Learn] Curriculum lookup failed, falling back to hash:', e.message); } // Fallback: hash-based assignment (backwards compatible) - const topics = await db.getTopics(); + const allTopics = await db.getTopics(); + // Filter out 'fact' type topics and 'exclude' relevance topics + const topics = allTopics.filter(t => t.type !== 'fact' && t.learning_relevance !== 'exclude'); if (!topics || topics.length === 0) return null; const str = `${userId}:${weekNumber}`; diff --git a/src/lib/testService.js b/src/lib/testService.js index 624ae16..ea3bb34 100644 --- a/src/lib/testService.js +++ b/src/lib/testService.js @@ -8,7 +8,8 @@ Always write in clear, professional English. ALWAYS return valid JSON only — no markdown code blocks, no extra text.`; async function selectTestTopics(userId, weekNumber) { - const topics = await db.getTopics(); + const allTopics = await db.getTopics(); + const topics = allTopics.filter(t => t.type !== 'fact' && t.learning_relevance !== 'exclude'); if (!topics || topics.length === 0) return { primaryTopic: null, reviewTopics: [], isReviewWeek: false }; // Try curriculum-based selection first diff --git a/src/pages/Leren.jsx b/src/pages/Leren.jsx index f011ff1..c995e31 100644 --- a/src/pages/Leren.jsx +++ b/src/pages/Leren.jsx @@ -295,7 +295,7 @@ const Leren = () => { } // ── Overview ────────────────────────────────────────────── - const otherTopics = allTopics.filter(t => t.id !== assignedTopic?.id && t.type !== 'fact'); + const otherTopics = allTopics.filter(t => t.id !== assignedTopic?.id && t.type !== 'fact' && t.learning_relevance !== 'exclude'); const currentQuarter = getQuarterForWeek(state.weekNumber); const currentQuarterName = getQuarterName(state.weekNumber);