fix(gamification): полнота kill-switch — испытания/стрик/монеты + гейт счётчиков

Аудит выключателя геймификации выявил элементы, НЕ покрытые body.no-gamification:
испытания недели (#ch-section/.ch-widget), календарь стриков (.streak-cal),
стат-кольцо стрика (#sr-streak), монеты в профиле (#p-coins-row), чипы стрик/цель
на карточке питомца. Добавлены в CSS kill-switch (ls.css). Бэкенд: updateChallenges
и onLabExperiment писали прогресс/счётчики без проверки флага — добавлен гейт
isGamificationEnabled() (XP/coins/achievements уже гейтились в award*-функциях).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maxim Dolgolyov
2026-06-22 17:04:30 +03:00
parent d8f2a7f98d
commit dc71d7b4d9
2 changed files with 13 additions and 0 deletions
@@ -542,6 +542,7 @@ function onClassJoined(userId) {
}
function onLabExperiment(userId, reactionsDiscovered) {
if (!isGamificationEnabled()) return; // master kill-switch
stmts.incrLabExp.run(userId);
if (reactionsDiscovered > 0) stmts.incrLabReact.run(reactionsDiscovered, userId);
awardXP(userId, 15, 'lab_experiment');
@@ -650,6 +651,7 @@ function ensureChallenges(userId) {
}
function updateChallenges(userId, score, total, subjectSlug, topicId) {
if (!isGamificationEnabled()) return; // master kill-switch
const week = _currentWeek();
const pct = total > 0 ? Math.round(score / total * 100) : 0;
const challenges = stmts.getOpenChallenges.all(userId, week);