diff --git a/backend/src/controllers/assistantController.js b/backend/src/controllers/assistantController.js index d4bf384..b16beac 100644 --- a/backend/src/controllers/assistantController.js +++ b/backend/src/controllers/assistantController.js @@ -153,6 +153,13 @@ function weakSubject(uid) { } /* ── Долгая память об ученике ─────────────────────────────────────────── */ +// Темы экзамена хранятся англ. ключами (exam_tasks.topic) — показываем по-русски. +const _EXAM_TOPIC_RU = { + algebra: 'Алгебра', equations: 'Уравнения и неравенства', planimetry: 'Планиметрия', + geometry: 'Геометрия', 'word-sequences': 'Текстовые задачи', numbers: 'Числа и вычисления', + trigonometry: 'Тригонометрия', stereometry: 'Стереометрия', functions: 'Функции', + theory: 'Теория вероятностей', expressions: 'Выражения и преобразования', advanced: 'Повышенной сложности' +}; // Производный профиль (без LLM) — из уже накопленных сигналов. function _studentProfile(uid) { const out = { weakSubjects: [], weakTopics: [], exam: null, streak: 0 }; @@ -184,9 +191,10 @@ function _studentProfile(uid) { WHERE ea.user_id = ? AND et.topic IS NOT NULL AND et.topic <> ''${forget ? ' AND ea.created_at > ?' : ''} GROUP BY et.topic HAVING attempts >= 3 `).all(...(forget ? [uid, forget] : [uid])).forEach(r => { - const c = cand[r.topic]; + const topic = _EXAM_TOPIC_RU[r.topic] || r.topic; + const c = cand[topic]; if (c) { c.attempts += r.attempts; c.correct += (r.correct || 0); } - else cand[r.topic] = { topic: r.topic, attempts: r.attempts, correct: r.correct || 0 }; + else cand[topic] = { topic: topic, attempts: r.attempts, correct: r.correct || 0 }; }); } catch (e) {} out.weakTopics = Object.values(cand)