Expose per-product forecast errors
This commit is contained in:
1 parent
1639960ab6
commit
cc5661146c
2 files changed
+4
-2
No files matched your search
@@ -82,7 +82,8 @@ Nicht erforderlich. Die Produktmenge ist klein; die Verarbeitung erfolgt determi
|
|||||||
"total_products": 0,
|
"total_products": 0,
|
||||||
"processed_products": 0,
|
"processed_products": 0,
|
||||||
"failed_products": 0,
|
"failed_products": 0,
|
||||||
"failed_product_ids": []
|
"failed_product_ids": [],
|
||||||
|
"errors": [{"product_id": 0, "message": "..."}]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ function run_lager_stock_lot_forecast(PDO $pdo): array
|
|||||||
$asOfDate = new DateTimeImmutable('today', new DateTimeZone('Europe/Zurich'));
|
$asOfDate = new DateTimeImmutable('today', new DateTimeZone('Europe/Zurich'));
|
||||||
$result = [
|
$result = [
|
||||||
'status' => 'done', 'total_products' => 0, 'processed_products' => 0,
|
'status' => 'done', 'total_products' => 0, 'processed_products' => 0,
|
||||||
'failed_products' => 0, 'failed_product_ids' => [],
|
'failed_products' => 0, 'failed_product_ids' => [], 'errors' => [],
|
||||||
];
|
];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -208,6 +208,7 @@ function run_lager_stock_lot_forecast(PDO $pdo): array
|
|||||||
} catch (Throwable $error) {
|
} catch (Throwable $error) {
|
||||||
$result['failed_products']++;
|
$result['failed_products']++;
|
||||||
$result['failed_product_ids'][] = $productId;
|
$result['failed_product_ids'][] = $productId;
|
||||||
|
$result['errors'][] = ['product_id' => $productId, 'message' => $error->getMessage()];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($result['failed_products'] > 0) {
|
if ($result['failed_products'] > 0) {
|
||||||
|
|||||||
Reference in new issue
Block a user