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:
@@ -542,6 +542,7 @@ function onClassJoined(userId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onLabExperiment(userId, reactionsDiscovered) {
|
function onLabExperiment(userId, reactionsDiscovered) {
|
||||||
|
if (!isGamificationEnabled()) return; // master kill-switch
|
||||||
stmts.incrLabExp.run(userId);
|
stmts.incrLabExp.run(userId);
|
||||||
if (reactionsDiscovered > 0) stmts.incrLabReact.run(reactionsDiscovered, userId);
|
if (reactionsDiscovered > 0) stmts.incrLabReact.run(reactionsDiscovered, userId);
|
||||||
awardXP(userId, 15, 'lab_experiment');
|
awardXP(userId, 15, 'lab_experiment');
|
||||||
@@ -650,6 +651,7 @@ function ensureChallenges(userId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateChallenges(userId, score, total, subjectSlug, topicId) {
|
function updateChallenges(userId, score, total, subjectSlug, topicId) {
|
||||||
|
if (!isGamificationEnabled()) return; // master kill-switch
|
||||||
const week = _currentWeek();
|
const week = _currentWeek();
|
||||||
const pct = total > 0 ? Math.round(score / total * 100) : 0;
|
const pct = total > 0 ? Math.round(score / total * 100) : 0;
|
||||||
const challenges = stmts.getOpenChallenges.all(userId, week);
|
const challenges = stmts.getOpenChallenges.all(userId, week);
|
||||||
|
|||||||
@@ -1064,6 +1064,17 @@ body.no-gamification .xp-card,
|
|||||||
body.no-gamification .xp-bar,
|
body.no-gamification .xp-bar,
|
||||||
body.no-gamification .xp-pill,
|
body.no-gamification .xp-pill,
|
||||||
body.no-gamification .xp-badge,
|
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; }
|
body.no-gamification [data-gamified] { display: none !important; }
|
||||||
|
|
||||||
/* ══════════════════════════════════════════
|
/* ══════════════════════════════════════════
|
||||||
|
|||||||
Reference in New Issue
Block a user