fix: path is not defined in renderPage and HAVING clause SQL error
- 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 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -343,7 +343,7 @@ async function renderPage(route, previousPath = null) {
|
|||||||
// Route-Announcer: Screenreader über Seitenwechsel informieren (gezielt, nicht gesamter Inhalt)
|
// Route-Announcer: Screenreader über Seitenwechsel informieren (gezielt, nicht gesamter Inhalt)
|
||||||
const announcer = document.getElementById('route-announcer');
|
const announcer = document.getElementById('route-announcer');
|
||||||
if (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 = '';
|
announcer.textContent = '';
|
||||||
setTimeout(() => { announcer.textContent = pageLabel; }, 50);
|
setTimeout(() => { announcer.textContent = pageLabel; }, 50);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 AND si.is_checked = 0) AS open_count,
|
||||||
(SELECT COUNT(*) FROM shopping_items si WHERE si.list_id = sl.id) AS total_count
|
(SELECT COUNT(*) FROM shopping_items si WHERE si.list_id = sl.id) AS total_count
|
||||||
FROM shopping_lists sl
|
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
|
ORDER BY sl.updated_at DESC
|
||||||
LIMIT 3
|
LIMIT 3
|
||||||
`).all();
|
`).all();
|
||||||
|
|||||||
Reference in New Issue
Block a user