feat(exam-prep F8): слабые темы на дашборде + strategy=weak в тренажёре
This commit is contained in:
@@ -13,11 +13,16 @@
|
||||
|
||||
// Per-session state
|
||||
let batch = null; // { strategy, session_id, tasks: [...] }
|
||||
let strategy = readPersistedStrategy() || 'random';
|
||||
let strategy = readStrategyFromUrl() || readPersistedStrategy() || 'random';
|
||||
let count = readPersistedCount();
|
||||
let finalized = false;
|
||||
const results = new Map(); // taskId -> { isCorrect: 0|1|null, attempts: number }
|
||||
|
||||
function readStrategyFromUrl() {
|
||||
const m = location.search.match(/[?&]strategy=(random|unsolved|weak)/);
|
||||
return m ? m[1] : null;
|
||||
}
|
||||
|
||||
/* ── Strategy persistence (local pref) ──────────────────────── */
|
||||
function readPersistedStrategy() {
|
||||
try { return localStorage.getItem(`exam_prep_${examKey}_practice_strategy`); } catch { return null; }
|
||||
@@ -52,7 +57,8 @@
|
||||
<button class="pr-strategy-btn ${strategy === 'unsolved' ? 'active' : ''}" data-strat="unsolved">
|
||||
<i data-lucide="circle-dashed"></i> Только нерешённые
|
||||
</button>
|
||||
<button class="pr-strategy-btn disabled" disabled title="Появится в F8 после тегирования тем">
|
||||
<button class="pr-strategy-btn ${strategy === 'weak' ? 'active' : ''}" data-strat="weak"
|
||||
title="Топ-3 темы с худшей точностью (нужно ≥3 попыток в теме)">
|
||||
<i data-lucide="target"></i> Слабые темы
|
||||
</button>
|
||||
</div>
|
||||
@@ -192,7 +198,7 @@
|
||||
</div>
|
||||
<div class="pr-summary-stat">
|
||||
<div class="ep-stat-label">Стратегия</div>
|
||||
<div class="ep-stat-value" style="font-size:1.1rem">${strategy === 'unsolved' ? 'Нерешённые' : 'Случайные'}</div>
|
||||
<div class="ep-stat-value" style="font-size:1.1rem">${strategyLabel(strategy)}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ep-cta-row">
|
||||
@@ -233,4 +239,11 @@
|
||||
function escapeHtml(s) {
|
||||
return String(s || '').replace(/[&<>"']/g, c => ({ '&':'&', '<':'<', '>':'>', '"':'"', "'":''' }[c]));
|
||||
}
|
||||
|
||||
function strategyLabel(s) {
|
||||
if (s === 'unsolved') return 'Нерешённые';
|
||||
if (s === 'weak') return 'Слабые темы';
|
||||
if (s === 'unsolved-fallback') return 'Нерешённые (fallback)';
|
||||
return 'Случайные';
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user