fix(assistant): русские названия трудных тем в памяти

Темы экзамена в exam_tasks.topic хранятся англ. ключами (algebra, geometry,
functions, ...). Добавлена карта _EXAM_TOPIC_RU; в _studentProfile экзаменные
темы переводятся на русский перед слиянием с темами банка тестов.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maxim Dolgolyov
2026-06-24 22:51:10 +03:00
parent 29fc270c0e
commit ee740817a8
+10 -2
View File
@@ -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)