From dc71d7b4d961c46ca088e3adc9252895e716d6e0 Mon Sep 17 00:00:00 2001 From: Maxim Dolgolyov Date: Mon, 22 Jun 2026 17:04:30 +0300 Subject: [PATCH] =?UTF-8?q?fix(gamification):=20=D0=BF=D0=BE=D0=BB=D0=BD?= =?UTF-8?q?=D0=BE=D1=82=D0=B0=20kill-switch=20=E2=80=94=20=D0=B8=D1=81?= =?UTF-8?q?=D0=BF=D1=8B=D1=82=D0=B0=D0=BD=D0=B8=D1=8F/=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=B8=D0=BA/=D0=BC=D0=BE=D0=BD=D0=B5=D1=82=D1=8B=20+=20=D0=B3?= =?UTF-8?q?=D0=B5=D0=B9=D1=82=20=D1=81=D1=87=D1=91=D1=82=D1=87=D0=B8=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Аудит выключателя геймификации выявил элементы, НЕ покрытые 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) --- backend/src/controllers/gamification/service.js | 2 ++ frontend/css/ls.css | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/backend/src/controllers/gamification/service.js b/backend/src/controllers/gamification/service.js index 0c222f8..2d06b6a 100644 --- a/backend/src/controllers/gamification/service.js +++ b/backend/src/controllers/gamification/service.js @@ -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); diff --git a/frontend/css/ls.css b/frontend/css/ls.css index 337a090..187ae9c 100644 --- a/frontend/css/ls.css +++ b/frontend/css/ls.css @@ -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; } /* ══════════════════════════════════════════