From ca4f6a2bd6c5c8279ba7992cf538e4828d11da9b Mon Sep 17 00:00:00 2001 From: CarlNation Date: Mon, 7 Oct 2024 06:21:15 -0400 Subject: [PATCH] CSR-2243 Not actually related to CSR-2243 but found while debugging that issue. We set isGlassPart true for all items in that collection, even child parts like recal, molding and clips. Micro service team's latest changes is more strict with this property and returning a 404 error and then mule returns a 500 internal server error. --- src/store/index.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 5baf2a3a5..fedea9fd4 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -3201,14 +3201,16 @@ export function getArrayOfAllLineItemsAndChildParts(lineItems) { return consolidatedLineItemsArray; } -function getFlattenedArrayOfLineItemsWithChildParts(lineItems) { +function getFlattenedArrayOfLineItemsWithChildParts(lineItems, childPartRecursiveCall = false) { let flattenedArray = []; lineItems?.forEach((lineItem) => { + // this assumes childparts will never be a glass part + lineItem.isChildPart = childPartRecursiveCall; flattenedArray.push(lineItem); if (lineItem.childParts) { flattenedArray = [ ...flattenedArray, - ...getFlattenedArrayOfLineItemsWithChildParts(lineItem.childParts), + ...getFlattenedArrayOfLineItemsWithChildParts(lineItem.childParts, true), ]; } }); @@ -3231,11 +3233,7 @@ function getFlattenedLineItemsWithGlassPartTag(lineItems) { return { partNumber: lineItem.partNumber, partType: lineItem.partType, - isGlassPart: - lineItem.partType == partTypeStrings.RECALIBRATION || - lineItem.partType == partTypeStrings.ADAS_RECALIBRATION - ? false - : true, + isGlassPart: lineItem.isChildPart ? false : true, }; });