feat: implement curriculum service and learning automation infrastructure
This commit is contained in:
@@ -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}`;
|
||||
|
||||
Reference in New Issue
Block a user