multicloud_rule_manager 1.1.86 → 1.1.89

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.
@@ -196,6 +196,10 @@ export default {
196
196
 
197
197
  console.log(`📂 Totale categorie: ${categories.length}`);
198
198
 
199
+ let lastProductWritten = false;
200
+ let lastCategory = null;
201
+
202
+
199
203
  for (const cat of categories) {
200
204
  const children = getChildren(cat.guid);
201
205
 
@@ -205,40 +209,54 @@ export default {
205
209
 
206
210
  totalChildren += children.length;
207
211
 
212
+ const isNewCategory = lastCategory !== cat.name;
213
+
208
214
  if (children.length === 0) {
209
215
  rows1.push({
210
- "Product Name": product.name,
211
- "Product Eligible": productStructureRoot.eligible,
212
- "Category Name": cat.name,
213
- "Category Visible": cat.visible,
214
- "Category Visible Cart": cat.visible_cart,
216
+ "Product Name": !lastProductWritten ? product.name : "",
217
+ "Product Eligible": !lastProductWritten
218
+ ? productStructureRoot.eligible
219
+ : "",
220
+ "Category Name": isNewCategory ? cat.name : "",
221
+ "Category Visible": isNewCategory ? cat.visible : "",
222
+ "Category Visible Cart": isNewCategory
223
+ ? cat.visible_cart
224
+ : "",
215
225
  "Child Product Name": "",
216
226
  });
227
+
228
+ lastProductWritten = true;
229
+ lastCategory = cat.name;
217
230
  }
218
231
 
219
232
  for (const child of children) {
220
233
  rows1.push({
221
- "Product Name": product.name,
222
- "Product Eligible": productStructureRoot.eligible,
223
- "Category Name": cat.name,
224
- "Category Visible": cat.visible,
225
- "Category Visible Cart": cat.visible_cart,
226
- "Category Min Qty": cat.min_qty,
227
- "Category Dft Qty": cat.default_qty,
228
- "Category Max Qty": cat.max_qty,
234
+ "Product Name": !lastProductWritten ? product.name : "",
235
+ "Product Eligible": !lastProductWritten
236
+ ? productStructureRoot.eligible
237
+ : "",
238
+ "Category Name": isNewCategory ? cat.name : "",
239
+ "Category Visible": isNewCategory ? cat.visible : "",
240
+ "Category Visible Cart": isNewCategory
241
+ ? cat.visible_cart
242
+ : "",
243
+ "Category Min Qty": isNewCategory ? cat.min_qty : "",
244
+ "Category Dft Qty": isNewCategory ? cat.default_qty : "",
245
+ "Category Max Qty": isNewCategory ? cat.max_qty : "",
229
246
  "Child Product Name": child.name,
230
- "Category Visible": child.visible,
231
- "Category Visible Cart": child.visible_cart,
232
- "Category Min Qty": child.min_qty,
233
- "Category Dft Qty": child.default_qty,
234
- "Category Max Qty": child.max_qty
247
+ "Child Visible": child.visible,
248
+ "Child Visible Cart": child.visible_cart,
249
+ "Child Min Qty": child.min_qty,
250
+ "Child Dft Qty": child.default_qty,
251
+ "Child Max Qty": child.max_qty,
235
252
  });
236
253
 
254
+ lastProductWritten = true;
255
+ lastCategory = cat.name;
256
+
237
257
  if (!child.product_id) continue;
238
258
 
239
- const families = await getFamilies(
240
- child.product_id
241
- );
259
+ const families = await getFamilies(child.product_id);
242
260
 
243
261
  for (const f of families) {
244
262
  for (const attr of f.attributes) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "multicloud_rule_manager",
3
- "version": "1.1.86",
3
+ "version": "1.1.89",
4
4
  "description": "CLI interna per retrieve/upload con token",
5
5
  "main": "index.js",
6
6
  "type": "module",