From 1821b7147a227aba8e143e8d3d60c5d832538a24 Mon Sep 17 00:00:00 2001 From: Ulas Kalayci Date: Mon, 27 Apr 2026 12:24:39 +0200 Subject: [PATCH] fix: path is not defined in renderPage and HAVING clause SQL error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - router.js: route-announcer used bare `path` variable which is not in scope inside renderPage(); replaced with `route.path` - dashboard.js: shoppingLists query used `HAVING open_count > 0` without GROUP BY; SQLite rejects this — replaced with a WHERE subquery Co-Authored-By: Claude Sonnet 4.6 --- public/router.js | 2 +- server/routes/dashboard.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/router.js b/public/router.js index 4d3b514..12889bd 100644 --- a/public/router.js +++ b/public/router.js @@ -343,7 +343,7 @@ async function renderPage(route, previousPath = null) { // Route-Announcer: Screenreader über Seitenwechsel informieren (gezielt, nicht gesamter Inhalt) const announcer = document.getElementById('route-announcer'); if (announcer) { - const pageLabel = navItems().find((n) => n.path === path)?.label ?? path; + const pageLabel = navItems().find((n) => n.path === route.path)?.label ?? route.path; announcer.textContent = ''; setTimeout(() => { announcer.textContent = pageLabel; }, 50); } diff --git a/server/routes/dashboard.js b/server/routes/dashboard.js index 4e85d39..4d12b46 100644 --- a/server/routes/dashboard.js +++ b/server/routes/dashboard.js @@ -144,7 +144,7 @@ router.get('/', (req, res) => { (SELECT COUNT(*) FROM shopping_items si WHERE si.list_id = sl.id AND si.is_checked = 0) AS open_count, (SELECT COUNT(*) FROM shopping_items si WHERE si.list_id = sl.id) AS total_count FROM shopping_lists sl - HAVING open_count > 0 + WHERE (SELECT COUNT(*) FROM shopping_items si WHERE si.list_id = sl.id AND si.is_checked = 0) > 0 ORDER BY sl.updated_at DESC LIMIT 3 `).all();