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