From 474df4dea4942067aad32f0592c7c555fe29aa20 Mon Sep 17 00:00:00 2001 From: Katie Date: Wed, 31 Aug 2022 09:38:13 -0400 Subject: [PATCH] CSR-111 Fix vehicle-parts issue --- src/store/index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index e82b02251..e7db95ee2 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -225,7 +225,7 @@ export const mutations = { }, // applicationUser MUTATIONS - updateSaveOrderPromise(state, saveOrderPromise){ + updateSaveOrderPromise(state, saveOrderPromise) { state.applicationUser.saveOrderPromise = saveOrderPromise; }, updateSavedSessionId(state, savedSessionId) { @@ -392,7 +392,7 @@ export const getters = { parentAccountNumber: state.order.accountNumber, isCoverageVerified: state.order.payment.insuranceCoverage.isVerified, orderPartNumbers: [...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "partNumber"), ...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts, "partNumber")], - orderPartTypes: [...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "recalibrationType"), ...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts, "recalibrationType")], + orderPartTypes: [...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "recalibrationType"), ...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts, "recalibrationType")], hasRecalibrationPart: getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "requiresRecalibration")?.length > 0, selectedMultiGlass: state.order.damage.glassToReplace?.length > 1, selectedWindshieldGlass: getAllValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.WINDSHIELD), @@ -760,7 +760,7 @@ export const actions = { const part = pageData.partsOrQuestions.find(x => x.glassLocation === glassLocation).parts[0]; const capabilityQuestionAnswers = context.getters.damage.capabilityQuestionAnswers; const capabilityQuestionAnswersForPart = capabilityQuestionAnswers.find(x => x.glassLocation === glassLocation); - + return globalMethods.callHttpClient({ method: endpoints.GetPartFromCapabilityAnswer.method, endpoint: endpoints.GetPartFromCapabilityAnswer.url, @@ -1022,7 +1022,9 @@ export const actions = { const previousResultsArray = [{ parts: context.getters.lineItems.glassParts }]; function getAllPartNumbers(partsOrQuestions) { - return [...partsOrQuestions].map(glass => glass.parts).flat().map(part => part.partNumber).filter(partNumber => !partNumber.toUpperCase().includes("FEE")).sort().join(","); + return partsOrQuestions[0].parts + ? [...partsOrQuestions].map(glass => glass.parts).flat().map(part => part.partNumber).filter(partNumber => !partNumber.toUpperCase().includes("FEE")).sort().join(",") + : [] } const previouslySelectedPartNumbers = getAllPartNumbers(previousResultsArray); @@ -1041,7 +1043,7 @@ export const actions = { saveMoldingQuestionAnswers(context, moldingQuestionAnswers) { const previousResultsArray = context.getters.damage.moldingQuestionAnswers; const haveMoldingQuestionAnswersChanged = previousResultsArray?.length !== moldingQuestionAnswers.length || - !previousResultsArray.every((x, i) => x.partNum === moldingQuestionAnswers[i].partNum); + !previousResultsArray.every((x, i) => x.partNum === moldingQuestionAnswers[i].partNum); if (haveMoldingQuestionAnswersChanged) { context.commit(storeMutations.UPDATE_GLASS_PARTS, null);