From 326429657c24f53ebe3a89fbe955bdedb61d5897 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Fri, 9 Dec 2022 10:03:57 -0500 Subject: [PATCH] CSR-803: refactoring for readability --- src/mixins/vehicle-questions-mixin.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js index 2ae850a6c..73f9103a8 100644 --- a/src/mixins/vehicle-questions-mixin.js +++ b/src/mixins/vehicle-questions-mixin.js @@ -472,16 +472,17 @@ export default { fmgPageValues.PART_QUESTIONS ); - const currentPartsOrQuestions = ( - (currentPage !== fmgPageValues.CAPABILITY_QUESTIONS - ? pageDataCapabilityQuestions - : null) ?? - (currentPage !== fmgPageValues.MOLDING_QUESTIONS - ? pageDataMoldingQuestions - : null) ?? - (currentPage !== fmgPageValues.VEHICLE_PARTS ? pageDataVehicleParts : null) ?? - (currentPage !== fmgPageValues.PARTS_QUESTIONS ? pageDataPartQuestions : null) - )?.partsOrQuestions; + let currentPartsOrQuestions = null; + + if (currentPage !== fmgPageValues.CAPABILITY_QUESTIONS && !!pageDataCapabilityQuestions) { + currentPartsOrQuestions = pageDataCapabilityQuestions?.partsOrQuestions; + } else if (currentPage !== fmgPageValues.MOLDING_QUESTIONS && !!pageDataMoldingQuestions) { + currentPartsOrQuestions = pageDataMoldingQuestions?.partsOrQuestions; + } else if (currentPage !== fmgPageValues.VEHICLE_PARTS && !!pageDataVehicleParts) { + currentPartsOrQuestions = pageDataVehicleParts?.partsOrQuestions; + } else if (currentPage !== fmgPageValues.PARTS_QUESTIONS && !!pageDataPartQuestions) { + currentPartsOrQuestions = pageDataPartQuestions?.partsOrQuestions; + } const hasPartQuestions = this.hasPartQuestions(currentPartsOrQuestions); const hasGlassLocationWithMultipleParts =