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);
+11
View File
@@ -1064,6 +1064,17 @@ body.no-gamification .xp-card,
body.no-gamification .xp-bar,
body.no-gamification .xp-pill,
body.no-gamification .xp-badge,
/* challenges / еженедельные испытания (dashboard) */
body.no-gamification .ch-widget,
body.no-gamification #ch-section,
/* серия/стрик: календарь, стат-кольцо, чипы на карточке питомца */
body.no-gamification .streak-cal,
body.no-gamification #sr-streak,
body.no-gamification .hc-pet .chip-streak,
body.no-gamification .hc-pet .chip-goal,
/* монеты (профиль) и xp-прогресс */
body.no-gamification #p-coins-row,
body.no-gamification .gam-progress,
body.no-gamification [data-gamified] { display: none !important; }
/* ══════════════════════════════════════════