release: v1.7.30
This commit is contained in:
@@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- **Recipe scraps tips** — During cooking steps, detect "waste" generated (peels, cores, bones, eggshells, coffee grounds, citrus zest, etc.) and surface AI-powered tips on how to reuse them (compost, natural cleaner, broth, candied peel, etc.). Could be shown as an optional collapsible hint card below the step that generates the scrap.
|
||||
|
||||
## [1.7.30] - 2026-05-29
|
||||
|
||||
### Fixed
|
||||
- **False consumption anomaly with multi-row stock** — The anomaly detection banner was evaluating each inventory row in isolation. Products split across multiple rows (e.g. one opened pack with 1 pz + one sealed pack with 6 pz) incorrectly triggered a "consumed faster than expected" warning because only the opened row (1 pz) was compared against the model. The check now aggregates the total quantity across all rows for the same product before deciding to flag an anomaly. If the combined total ≥ expected remaining, the anomaly is suppressed.
|
||||
|
||||
|
||||
## [1.7.29] - 2026-05-29
|
||||
|
||||
### Added
|
||||
|
||||
@@ -4155,6 +4155,24 @@ function getConsumptionPredictions(PDO $db): void {
|
||||
$expectedQty = max(0, $baselineQty - ($dailyRate * $daysSinceRestock));
|
||||
$actualQty = floatval($item['quantity']);
|
||||
|
||||
// Aggregate total stock for this product across ALL inventory rows.
|
||||
// A product may be split into multiple rows (e.g. one opened pack + one
|
||||
// sealed pack at a different location). The opened row alone may look
|
||||
// depleted while the total is healthy — do not flag in that case.
|
||||
$totalQtyStmt = $db->prepare("
|
||||
SELECT COALESCE(SUM(quantity), 0)
|
||||
FROM inventory
|
||||
WHERE product_id = ? AND quantity > 0
|
||||
");
|
||||
$totalQtyStmt->execute([$pid]);
|
||||
$totalQtyAllRows = floatval($totalQtyStmt->fetchColumn() ?: 0);
|
||||
// If the aggregate total is above the expected remaining, the "depletion"
|
||||
// is just stock spread across rows — suppress the anomaly.
|
||||
if ($totalQtyAllRows >= $expectedQty) continue;
|
||||
// Use the aggregate total as the visible actual qty so the banner shows
|
||||
// the real combined stock, not just the single opened row.
|
||||
$actualQty = $totalQtyAllRows;
|
||||
|
||||
// Need at least some post-restock usage observations before warning.
|
||||
if ($txSinceRestock < 2) continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user