From d056a6a116b02b7295f975b00cc985ee27f06c08 Mon Sep 17 00:00:00 2001 From: dadaloop82 Date: Mon, 11 May 2026 17:35:53 +0000 Subject: [PATCH] fix: expired section hides items with quantity=0 Query was missing AND i.quantity > 0, so thrown-away items (qty=0) with a past expiry_date kept appearing in the expired list. Also cleaned up the orphan row for Aglio in the DB. --- api/index.php | 2 +- index.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/index.php b/api/index.php index 194e892..6006566 100644 --- a/api/index.php +++ b/api/index.php @@ -1892,7 +1892,7 @@ function getStats(PDO $db): void { SELECT i.*, p.name, p.brand, p.category, p.unit, p.default_quantity, p.package_unit, COALESCE(i.vacuum_sealed, 0) as vacuum_sealed FROM inventory i JOIN products p ON i.product_id = p.id - WHERE i.expiry_date IS NOT NULL AND i.expiry_date < date('now') + WHERE i.expiry_date IS NOT NULL AND i.expiry_date < date('now') AND i.quantity > 0 ORDER BY i.expiry_date ASC ")->fetchAll(); diff --git a/index.html b/index.html index e3566fe..71e37a1 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,7 @@ EverShelf - + @@ -1469,6 +1469,6 @@ - +