diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js index dc1cf0a71..93e57daeb 100644 --- a/src/mixins/vehicle-questions-mixin.js +++ b/src/mixins/vehicle-questions-mixin.js @@ -473,35 +473,18 @@ export default { fmgPageValues.PART_QUESTIONS ); - let currentPartsOrQuestions = null; + const allPartsOrQuestions = [ + ...(pageDataCapabilityQuestions?.partsOrQuestions || []), + ...(pageDataMoldingQuestions?.partsOrQuestions || []), + ...(pageDataVehicleParts?.partsOrQuestions || []), + ...(pageDataPartQuestions?.partsOrQuestions || []), + ]; - if ( - this.currentPageComesAfterPage(currentPage, fmgPageValues.CAPABILITY_QUESTIONS) && - !!pageDataCapabilityQuestions - ) { - currentPartsOrQuestions = pageDataCapabilityQuestions?.partsOrQuestions; - } else if ( - this.currentPageComesAfterPage(currentPage, fmgPageValues.MOLDING_QUESTIONS) && - !!pageDataMoldingQuestions - ) { - currentPartsOrQuestions = pageDataMoldingQuestions?.partsOrQuestions; - } else if ( - this.currentPageComesAfterPage(currentPage, fmgPageValues.VEHICLE_PARTS) && - !!pageDataVehicleParts - ) { - currentPartsOrQuestions = pageDataVehicleParts?.partsOrQuestions; - } else if ( - this.currentPageComesAfterPage(currentPage, fmgPageValues.PARTS_QUESTIONS) && - !!pageDataPartQuestions - ) { - currentPartsOrQuestions = pageDataPartQuestions?.partsOrQuestions; - } - - const hasPartQuestions = this.hasPartQuestions(currentPartsOrQuestions); + const hasPartQuestions = this.hasPartQuestions(allPartsOrQuestions); const hasGlassLocationWithMultipleParts = - this.hasGlassLocationWithMultipleParts(currentPartsOrQuestions); - const hasChildPartQuestions = this.hasChildPartQuestions(currentPartsOrQuestions); - const hasCapabilityQuestions = this.hasCapabilityQuestions(currentPartsOrQuestions); + this.hasGlassLocationWithMultipleParts(allPartsOrQuestions); + const hasChildPartQuestions = this.hasChildPartQuestions(allPartsOrQuestions); + const hasCapabilityQuestions = this.hasCapabilityQuestions(allPartsOrQuestions); const skipVinLookup = await store.dispatch(storeActions.IS_VIN_OPTIONAL_VEHICLE); const vin = self.$store.getters.vehicle.vin;