From 332286b64180e7c924e6123b5d1b2dbe5fa636cc Mon Sep 17 00:00:00 2001 From: Antigravity Date: Tue, 6 Oct 2026 16:12:05 +0300 Subject: [PATCH] fix(cefr): fix ReferenceError q is not defined in handleOptionTap, bump PWA to v5.4 --- app/static/index.html | 4 ++-- app/static/js/modules/cefr.js | 7 +++++-- app/static/sw.js | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/static/index.html b/app/static/index.html index 1ac0e89..77cfcdb 100644 --- a/app/static/index.html +++ b/app/static/index.html @@ -5,7 +5,7 @@ Notes — Персональный тренажер и словарь английского языка - + @@ -1383,7 +1383,7 @@ - + diff --git a/app/static/js/modules/cefr.js b/app/static/js/modules/cefr.js index 7d915fe..00a4837 100644 --- a/app/static/js/modules/cefr.js +++ b/app/static/js/modules/cefr.js @@ -352,6 +352,9 @@ async function handleOptionTap(questionId, selectedOption, clickedBtn) { if (isAnswered) return; isAnswered = true; + const q = currentQuiz[currentQuestionIdx]; + const sentence = q ? q.sentence : ''; + // Disable all options document.querySelectorAll('.cefr-opt-btn').forEach(b => { b.disabled = true; @@ -384,7 +387,7 @@ async function handleOptionTap(questionId, selectedOption, clickedBtn) { ${renderOptionsBreakdown(res.options_breakdown)} `; feedbackBox.classList.remove('hidden'); - attachBreakdownListeners(feedbackBox, q.sentence); + attachBreakdownListeners(feedbackBox, sentence); } } else { sessionStats.mistakes++; @@ -433,7 +436,7 @@ async function handleOptionTap(questionId, selectedOption, clickedBtn) { ${renderOptionsBreakdown(res.options_breakdown)} `; feedbackBox.classList.remove('hidden'); - attachBreakdownListeners(feedbackBox, q.sentence); + attachBreakdownListeners(feedbackBox, sentence); } } diff --git a/app/static/sw.js b/app/static/sw.js index 7adac4f..488a88d 100644 --- a/app/static/sw.js +++ b/app/static/sw.js @@ -1,7 +1,7 @@ // Service Worker for Notes English PWA (Stage 2) // Strategy: Cache-first for static assets, Network-first for API calls. -const CACHE_NAME = 'notes-v5.3'; +const CACHE_NAME = 'notes-v5.4'; const OFFLINE_URL = '/'; const PRECACHE_URLS = [