From 0354c44fc8afc096e44ebf29fcc9bbc99e1b828b Mon Sep 17 00:00:00 2001 From: Pedro Costa Date: Mon, 5 Sep 2022 07:10:05 -0300 Subject: [PATCH] refs #117 - fix validate batches --- fgt-api/managers/SimpleShipmentManager.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fgt-api/managers/SimpleShipmentManager.js b/fgt-api/managers/SimpleShipmentManager.js index 10dc9223..0a43e686 100644 --- a/fgt-api/managers/SimpleShipmentManager.js +++ b/fgt-api/managers/SimpleShipmentManager.js @@ -245,6 +245,9 @@ class SimpleShipmentManager extends Manager { if (err) return _callback(err); + if (!accum.hasOwnProperty(sl.gtin)) + accum[sl.gtin] = []; + accum[sl.gtin].push(new Batch({ batchNumber: sl.batch, quantity: factor * sl.quantity