@managesome/eposmatic-toolkit 0.2.592 → 0.2.593
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -76,12 +76,21 @@ function getWarehouseCatalogFetchedData(categories, items) {
|
|
|
76
76
|
items: [],
|
|
77
77
|
},
|
|
78
78
|
}), {});
|
|
79
|
+
// Secondary lookup by category _id: synced categories carry a fresh per-target
|
|
80
|
+
// _id (≠ ref_id) while items store that category _id, so a ref_id-only lookup
|
|
81
|
+
// would silently drop those items from the catalog.
|
|
82
|
+
const categoriesByItemId = categories.reduce((acc, category) => {
|
|
83
|
+
if (category._id != null) {
|
|
84
|
+
acc[category._id] = categoriesObj[category.ref_id];
|
|
85
|
+
}
|
|
86
|
+
return acc;
|
|
87
|
+
}, {});
|
|
79
88
|
const uncategorizedItems = [];
|
|
80
89
|
for (let i = 0; i < items.length; i++) {
|
|
81
90
|
const item = items[i];
|
|
82
91
|
const sortedItem = getPartialWarehouseItemWithPrice(item);
|
|
83
92
|
if (item.category_id) {
|
|
84
|
-
categoriesObj[item.category_id]?.items.push(sortedItem);
|
|
93
|
+
(categoriesObj[item.category_id] ?? categoriesByItemId[item.category_id])?.items.push(sortedItem);
|
|
85
94
|
}
|
|
86
95
|
else {
|
|
87
96
|
uncategorizedItems.push(sortedItem);
|