CSR-110: refactoring from PR comments
This commit is contained in:
parent
8034ce8d28
commit
b53479dbf1
6 changed files with 14 additions and 16 deletions
|
|
@ -159,7 +159,7 @@ export default {
|
|||
this.$router.navigate(this.navigationScenarios.HAS_CAPABILITY_QUESTIONS,this.$route,{},{},{partsOrQuestions: glassNameAndPartsForStore});
|
||||
} else {
|
||||
// if single parts only
|
||||
const collectedGlassParts = this.reduceGlassPartsArray(glassNameAndPartsForStore);
|
||||
const collectedGlassParts = this.reducedGlassPartsArray(glassNameAndPartsForStore);
|
||||
// save to store lineItems.glassParts
|
||||
this.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts);
|
||||
// go to heritage quote page
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ export default {
|
|||
this.$router.navigate(this.navigationScenarios.HAS_CAPABILITY_QUESTIONS,this.$route,{},{},{partsOrQuestions: glassNameAndPartsForStore});
|
||||
} else {
|
||||
// if single parts only
|
||||
const collectedGlassParts = this.reduceGlassPartsArray(glassNameAndPartsForStore);
|
||||
const collectedGlassParts = this.reducedGlassPartsArray(glassNameAndPartsForStore);
|
||||
// save to store lineItems.glassParts
|
||||
this.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts);
|
||||
// go to heritage quote page
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ export default {
|
|||
|
||||
} else {
|
||||
// if single parts only
|
||||
const collectedGlassParts = this.reduceGlassPartsArray(matchedParts);
|
||||
const collectedGlassParts = this.reducedGlassPartsArray(matchedParts);
|
||||
// save to store lineItems.glassParts
|
||||
this.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts);
|
||||
|
||||
|
|
|
|||
|
|
@ -19,20 +19,20 @@ export default {
|
|||
},
|
||||
// method to only include keys listed for lineItems.glassParts in
|
||||
// https://safelite.atlassian.net/wiki/spaces/DC/pages/17137665/Catalog+Front-End+State#glassParts
|
||||
reduceGlassPartsArray(glassParts) {
|
||||
reducedGlassPartsArray(glassParts) {
|
||||
const reducedGlassParts = [];
|
||||
glassParts.forEach((glass) => {
|
||||
if (Array.isArray(glass.parts) && glass.parts.length === 1) {
|
||||
const singlePart = glass.parts[0];
|
||||
reducedGlassParts.push({
|
||||
"partNumber": singlePart.partNumber,
|
||||
"description": singlePart.description,
|
||||
"color": singlePart.color,
|
||||
"requiresRecalibration": singlePart.requiresRecalibration,
|
||||
"requiresCapabilityQuestions": singlePart.requiresCapabilityQuestions,
|
||||
"recalibrationType": singlePart.recalibrationType,
|
||||
"childParts": singlePart.childParts,
|
||||
"price": singlePart.price,
|
||||
partNumber: singlePart.partNumber,
|
||||
description: singlePart.description,
|
||||
color: singlePart.color,
|
||||
requiresRecalibration: singlePart.requiresRecalibration,
|
||||
requiresCapabilityQuestions: singlePart.requiresCapabilityQuestions,
|
||||
recalibrationType: singlePart.recalibrationType,
|
||||
childParts: singlePart.childParts,
|
||||
price: singlePart.price,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@ export default {
|
|||
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
|
||||
const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions);
|
||||
|
||||
// TODO - ADD CHECK FOR CAPABILITY QUESTIONS TO SEE IF NAVIGATE TO CAPABILITY-QUESTIONS
|
||||
|
||||
if (hasPartsQuestions) {
|
||||
this.$router.navigate(this.navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS, this.$route, {}, {}, result.data);
|
||||
}
|
||||
|
|
@ -32,7 +30,7 @@ export default {
|
|||
}
|
||||
else {
|
||||
// if single parts only
|
||||
const collectedGlassParts = this.reduceGlassPartsArray(result.data.partsOrQuestions);
|
||||
const collectedGlassParts = this.reducedGlassPartsArray(result.data.partsOrQuestions);
|
||||
// save to store lineItems.glassParts
|
||||
this.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts);
|
||||
|
||||
|
|
|
|||
|
|
@ -866,7 +866,7 @@ describe("vin-pages-mixin", () => {
|
|||
|
||||
wrapper.vm.$store.commit = jest.fn();
|
||||
|
||||
const collectedGlassParts = wrapper.vm.reduceGlassPartsArray(partsOrQuestions);
|
||||
const collectedGlassParts = wrapper.vm.reducedGlassPartsArray(partsOrQuestions);
|
||||
|
||||
// Act
|
||||
await wrapper.vm.navigateForwardWithSingleCarMatch();
|
||||
|
|
|
|||
Loading…
Reference in a new issue