From 2be1a91e16244fc94e12ea35b7637368c369331a Mon Sep 17 00:00:00 2001 From: Alex Humphries Date: Mon, 4 May 2026 15:39:34 -0400 Subject: [PATCH] INSR-9513: Remove console.log, handle multiple recal parts in price calc --- src/helpers/cart-helper.js | 5 +++-- src/store/index.js | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/helpers/cart-helper.js b/src/helpers/cart-helper.js index 1920df3c..22b0dcdb 100644 --- a/src/helpers/cart-helper.js +++ b/src/helpers/cart-helper.js @@ -165,8 +165,9 @@ export function getCartTotal(order) { export function getRecalibrationTotal(order) { const itemsWithRecalibration = getServiceLineItems(order) .filter((item) => item.requiresRecalibration); - const recalibrationLineItems = itemsWithRecalibration.map((item) => { - return item.childParts?.find((child) => child.partType === partTypeStrings.RECALIBRATION || child.partType === partTypeStrings.ADAS_RECALIBRATION) ?? {}; + + const recalibrationLineItems = itemsWithRecalibration.flatMap((item) => { + return item.childParts?.filter((child) => child.partType === partTypeStrings.RECALIBRATION || child.partType === partTypeStrings.ADAS_RECALIBRATION) ?? []; }); return getPriceOfLineItems(recalibrationLineItems); diff --git a/src/store/index.js b/src/store/index.js index ca323c1c..955c7283 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1133,7 +1133,6 @@ export const useMainStore = defineStore({ if (glassPart) { for (const recalPartInformation of recalPartArray) { const recalChildPart = glassPart.childParts?.find((cp) => cp.partNumber === recalPartInformation.partNumber); - console.log('Existing recalibration child part found', recalChildPart); if (!recalChildPart) { if (!Array.isArray(glassPart.childParts) || !glassPart.childParts.length) { glassPart.childParts = [];