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.
This commit is contained in:
dadaloop82
2026-05-11 17:35:53 +00:00
parent cb39b63997
commit d056a6a116
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -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();