+
@@ -117,24 +117,24 @@ export default {
const moldingQuestionsFromPageData = store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS);
return moldingQuestionsFromPageData && Object.keys(moldingQuestionsFromPageData).length > 0;
},
- showThisQuestionChain(glassPart, i) {
- if (part.partQuestions?.length < 1 || part.isSuppressedPart) { return false; } // return false if no partQuestions or if suppressed
- return this.currentPartNum === i || glassPart.answerData?.answerResult?.length > 0;
+ showThisQuestionChain(glass, i) {
+ if (glass.questions?.length < 1 || glass.isSuppressedPart) { return false; } // return false if no questions or if suppressed
+ return this.currentPartNum === i || glass.answerData?.answerResult?.length > 0;
},
async forwardButtonAction() {
- const questionAnswersArray = this.moldingQuestionsData.map((glassPart) => {
+ const questionAnswersArray = this.moldingQuestionsData.map((glass) => {
return {
- glassLocation: glassPart.glassLocation,
- glassName: glassPart.glassName,
- partNum: glassPart.answerData.answerResult,
- answeredQuestions: glassPart.answerData.answeredQuestions,
- isSuppressedPart: glassPart.isSuppressedPart,
+ glassLocation: glass.glassLocation,
+ glassName: glass.glassName,
+ partNum: glass.answerData.answerResult,
+ answeredQuestions: glass.answerData.answeredQuestions,
+ isSuppressedPart: glass.isSuppressedPart,
};
});
// clear out answerData for future page loads; must occur prior to store save
- this.moldingQuestionsData.forEach((glassPart) => {
- glassPart.answerData = {};
+ this.moldingQuestionsData.forEach((glass) => {
+ glass.answerData = {};
});
// save to vuex store as order.damage.partQuestionAnswers (array)
@@ -171,7 +171,7 @@ export default {
"questionNum": 1,
}
],
- "glassPartIndex": 0
+ "glassIndex": 0
}
*/
@@ -194,18 +194,18 @@ export default {
// HANDLE DUPLICATE QUESTIONS
// loop through all glass parts data
- this.moldingQuestionsData.forEach((glassPart, gpIndex) => {
+ this.moldingQuestionsData.forEach((glass, gpIndex) => {
// only look for duplicates forward... to parts that follow after the currently being answered part
- if (gpIndex > answer.glassPartIndex) {
+ if (gpIndex > answer.glassIndex) {
let suppressUntil;
// reset this glass part, in case user is changing their previous answers
- glassPart.answerData = null;
- glassPart.isSuppressedPart = null;
+ glass.answerData = null;
+ glass.isSuppressedPart = null;
// loop through this glass part's part questions, looking for a questionText match
- glassPart.questions.forEach((pq, pqIndex) => {
+ glass.questions.forEach((pq, pqIndex) => {
// clear out any previously set answers
pq.answerSelected = null;
@@ -225,11 +225,11 @@ export default {
// if these match then we have a duplicate question
if (pq.questionText.toUpperCase() === answeredQuestionText) {
- const thisAnsweredPartQuestion = glassPart.partQuestions[pqIndex];
+ const thisAnsweredPartQuestion = glass.questions[pqIndex];
let matchedAnswer;
let rejectedAnswers = []; // set as an array, in case we ever have questions with more than 2 answers...
- // which one of this partQuestions' answers matches our answer?
+ // which one of this questions' answers matches our answer?
pq.answers.forEach((ans) => {
if (ans.answerText.toUpperCase() === answeredQuestionAnswer) {
matchedAnswer = ans;
@@ -247,7 +247,7 @@ export default {
if (matchedAnswer.nextQuestionSequence) {
// ensure that the question that the accepted answer has set to be next is NOT suppressed
- glassPart.partQuestions[matchedAnswer.nextQuestionSequence - 1].suppressQuestion = null;
+ glass.questions[matchedAnswer.nextQuestionSequence - 1].suppressQuestion = null;
// if the duplicate is the 1ST question, then set suppressUntil var to lowest nextQuestion number
if (pqIndex === 0) {
if (!suppressUntil) { suppressUntil = matchedAnswer.nextQuestionSequence }
@@ -256,7 +256,7 @@ export default {
}
// handle suppressing upstream in this question chain
- glassPart.partQuestions.forEach((q) => {
+ glass.questions.forEach((q) => {
q.answers.forEach((thisAns) => {
// restore any of the answers that formerly led to the duplicated question
if (thisAns.originalNextQuestionSequence === pq.questionSequence) {
@@ -288,7 +288,7 @@ export default {
// suppress current question
thisAnsweredPartQuestion.suppressQuestion = true;
- const thisGlassPart = "glassPart" + gpIndex;
+ const thisGlassPart = "glass" + gpIndex;
if (this.foundDuplicateQuestions[thisGlassPart]) {
if (!this.foundDuplicateQuestions[thisGlassPart].includes(thisAnsweredPartQuestion.questionSequence)) {
this.foundDuplicateQuestions[thisGlassPart].push(thisAnsweredPartQuestion.questionSequence);
@@ -298,7 +298,7 @@ export default {
}
// are there any questions left that are not suppressed?
- const remainingQuestions = glassPart.partQuestions.filter((q) => {
+ const remainingQuestions = glass.questions.filter((q) => {
return !q.suppressQuestion;
});
@@ -313,13 +313,13 @@ export default {
suppressQuestion: pq.suppressQuestion,
};
// set the answerData as 'already answered'
- glassPart.answerData = {
+ glass.answerData = {
answerResult: matchedAnswer.nextQuestionSequence ? matchedAnswer.nextQuestionSequence : matchedAnswer.answerResult,
answeredQuestions: [answeredQuestionObj],
};
- // suppress this glassPart because it has an answer
- glassPart.isSuppressedPart = true;
+ // suppress this glass because it has an answer
+ glass.isSuppressedPart = true;
}
}
@@ -347,16 +347,16 @@ export default {
// "glassPart2": [7, 10]
// };
- const thisPartsDupes = this.foundDuplicateQuestions["glassPart" + answer.glassPartIndex];
+ const thisPartsDupes = this.foundDuplicateQuestions["glass" + answer.glassIndex];
const completeAnsweredQuestions = answer.answeredQuestions ? [...answer.answeredQuestions] : [];
- const glassPartAnswered = this.moldingQuestionsData[answer.glassPartIndex];
+ const glassPartAnswered = this.moldingQuestionsData[answer.glassIndex];
thisPartsDupes?.forEach((dupe) => {
// dupe is a single integer
- const dupeQuestion = glassPartAnswered.partQuestions[dupe - 1];
+ const dupeQuestion = glassPartAnswered.questions[dupe - 1];
const dupeQuestionAnswer = dupeQuestion.answers.find((q) => q.selected === true);
- glassPartAnswered.partQuestions.forEach((q) => {
+ glassPartAnswered.questions.forEach((q) => {
let includeThisDupeInAnsweredQuestions = false;
// did one of the answers of this question point to the duplicated question?
@@ -400,7 +400,7 @@ export default {
}
// this part has been fully answered, so advance to next molding question chain
- for (let i = answer.glassPartIndex + 1; i < this.moldingQuestionsData.length; i++) {
+ for (let i = answer.glassIndex + 1; i < this.moldingQuestionsData.length; i++) {
// if this part has not yet been fully answered, then make it the current part
if (!this.moldingQuestionsData[i].answerData?.answerResult) {
this.currentPartNum = i;
@@ -414,14 +414,14 @@ export default {
// are there alreadyAnsweredQuestions?
const alreadyAnsweredQuestions = store.getters.damage.partQuestionAnswers;
- this.moldingQuestionsData = this.pageData.partsOrQuestions.filter(x => x.parts[0].childPartQuestions.length).map((glassPart, i) => {
- glassPart.key = glassPart.glassLocation + "-" + glassPart.glassName;
+ this.moldingQuestionsData = this.pageData.partsOrQuestions.filter(x => x.parts[0].childPartQuestions.length).map((glass, i) => {
+ glass.key = glass.glassLocation + "-" + glass.glassName;
// NOTE: property "questions" can differ between layouts
- glassPart.questions = glassPart.parts[0].childPartQuestions;
+ glass.questions = glass.parts[0].childPartQuestions;
- this.selectedAnswers[glassPart.key] = [];
+ this.selectedAnswers[glass.key] = [];
if (!alreadyAnsweredQuestions) {
- glassPart.answerData = null;
+ glass.answerData = null;
}
alreadyAnsweredQuestions?.forEach((savedPart) => {
@@ -429,7 +429,7 @@ export default {
if (!savedPart.glassLocation || !savedPart.glassName || !savedPart.answeredQuestions || !savedPart.result) {
return;
}
- if (glassPart.glassLocation === savedPart.glassLocation && glassPart.glassName === savedPart.glassName) {
+ if (glass.glassLocation === savedPart.glassLocation && glass.glassName === savedPart.glassName) {
let answerString = "";
// matches; loop through answeredQuestions for matches
@@ -438,7 +438,7 @@ export default {
return;
}
// determine which answer was previously chosen
- const theAns = glassPart.partQuestions[aq.questionNum-1].answers.find((a) => {
+ const theAns = glass.questions[aq.questionNum-1].answers.find((a) => {
return a.answerText.toUpperCase() === aq.selectedAnswerText.toUpperCase();
});
if (theAns.nextQuestionSequence) {
@@ -448,18 +448,18 @@ export default {
}
// mark this partQuestion as answered (question-chain will read this)
- glassPart.partQuestions[aq.questionNum-1].answerSelected = answerString;
+ glass.questions[aq.questionNum-1].answerSelected = answerString;
// mark this partQuestion as duplicate if it is (question-chain will read this)
if (aq.suppressQuestion) {
- glassPart.partQuestions[aq.questionNum-1].suppressQuestion = true;
+ glass.questions[aq.questionNum-1].suppressQuestion = true;
}
});
// advance the currentPartNum
this.currentPartNum = i;
- // add answerData to current glassPart
- glassPart.answerData = {
+ // add answerData to current glass
+ glass.answerData = {
answerResult: savedPart.result,
answeredQuestions: savedPart.answeredQuestions
}
@@ -467,14 +467,14 @@ export default {
});
- // Set up watch for each set of glassPart questions, which gets updated when all questions for a glassPart have been answered
- this.$watch("selectedAnswers." + glassPart.key, (newValue) => {
+ // Set up watch for each set of glass questions, which gets updated when all questions for a glass have been answered
+ this.$watch("selectedAnswers." + glass.key, (newValue) => {
if (newValue) {
- this.handleAnswerUpdates(glassPart.key, newValue);
+ this.handleAnswerUpdates(glass.key, newValue);
}
}, {deep: true})
- return glassPart;
+ return glass;
});
},
diff --git a/src/layouts/part-questions/part-questions.vue b/src/layouts/part-questions/part-questions.vue
index 9f3227c70..572a03cca 100644
--- a/src/layouts/part-questions/part-questions.vue
+++ b/src/layouts/part-questions/part-questions.vue
@@ -20,14 +20,14 @@
:manualCopy="AlertFewMoreQuestionsCopy"
v-bind:isDismissible="false"
/>
-
+
@@ -117,24 +117,24 @@ export default {
const partQuestionsFromPageData = store.getters.pageData(fmgPageValues.PART_QUESTIONS);
return partQuestionsFromPageData && Object.keys(partQuestionsFromPageData).length > 0;
},
- showThisQuestionChain(glassPart, i) {
- if (glassPart.questions?.length < 1 || glassPart.isSuppressedPart) { return false; } // return false if no questions or if suppressed
- return this.currentPartNum === i || glassPart.answerData?.answerResult?.length > 0;
+ showThisQuestionChain(glass, i) {
+ if (!glass.questions || glass.questions?.length < 1 || glass.isSuppressedPart) { return false; } // return false if no questions or if suppressed
+ return this.currentPartNum === i || glass.answerData?.answerResult?.length > 0;
},
async forwardButtonAction() {
- const questionAnswersArray = this.partsQuestionsData.map((glassPart) => {
+ const questionAnswersArray = this.partsQuestionsData.map((glass) => {
return {
- glassLocation: glassPart.glassLocation,
- glassName: glassPart.glassName,
- result: glassPart.answerData.answerResult,
- answeredQuestions: glassPart.answerData.answeredQuestions,
- isSuppressedPart: glassPart.isSuppressedPart,
+ glassLocation: glass.glassLocation,
+ glassName: glass.glassName,
+ result: glass.answerData.answerResult,
+ answeredQuestions: glass.answerData.answeredQuestions,
+ isSuppressedPart: glass.isSuppressedPart,
};
});
// clear out answerData for future page loads; must occur prior to store save
- this.partsQuestionsData.forEach((glassPart) => {
- glassPart.answerData = {};
+ this.partsQuestionsData.forEach((glass) => {
+ glass.answerData = {};
});
// save to vuex store as order.damage.partQuestionAnswers (array)
@@ -167,7 +167,7 @@ export default {
"questionNum": 1,
}
],
- "glassPartIndex": 0
+ "glassIndex": 0
}
*/
@@ -190,18 +190,18 @@ export default {
// HANDLE DUPLICATE QUESTIONS
// loop through all glass parts data
- this.partsQuestionsData.forEach((glassPart, gpIndex) => {
+ this.partsQuestionsData.forEach((glass, gpIndex) => {
// only look for duplicates forward... to parts that follow after the currently being answered part
- if (gpIndex > answer.glassPartIndex) {
+ if (gpIndex > answer.glassIndex) {
let suppressUntil;
// reset this glass part, in case user is changing their previous answers
- glassPart.answerData = null;
- glassPart.isSuppressedPart = null;
+ glass.answerData = null;
+ glass.isSuppressedPart = null;
// loop through this glass part's questions, looking for a questionText match
- glassPart.questions.forEach((pq, pqIndex) => {
+ glass.questions.forEach((pq, pqIndex) => {
// clear out any previously set answers
pq.answerSelected = null;
@@ -221,7 +221,7 @@ export default {
// if these match then we have a duplicate question
if (pq.questionText.toUpperCase() === answeredQuestionText) {
- const thisAnsweredQuestion = glassPart.questions[pqIndex];
+ const thisAnsweredQuestion = glass.questions[pqIndex];
let matchedAnswer;
let rejectedAnswers = []; // set as an array, in case we ever have questions with more than 2 answers...
@@ -243,7 +243,7 @@ export default {
if (matchedAnswer.nextQuestionSequence) {
// ensure that the question that the accepted answer has set to be next is NOT suppressed
- glassPart.questions[matchedAnswer.nextQuestionSequence - 1].suppressQuestion = null;
+ glass.questions[matchedAnswer.nextQuestionSequence - 1].suppressQuestion = null;
// if the duplicate is the 1ST question, then set suppressUntil var to lowest nextQuestion number
if (pqIndex === 0) {
if (!suppressUntil) { suppressUntil = matchedAnswer.nextQuestionSequence }
@@ -252,7 +252,7 @@ export default {
}
// handle suppressing upstream in this question chain
- glassPart.questions.forEach((q) => {
+ glass.questions.forEach((q) => {
q.answers.forEach((thisAns) => {
// restore any of the answers that formerly led to the duplicated question
if (thisAns.originalNextQuestionSequence === pq.questionSequence) {
@@ -284,7 +284,7 @@ export default {
// suppress current question
thisAnsweredQuestion.suppressQuestion = true;
- const thisGlassPart = "glassPart" + gpIndex;
+ const thisGlassPart = "glass" + gpIndex;
if (this.foundDuplicateQuestions[thisGlassPart]) {
if (!this.foundDuplicateQuestions[thisGlassPart].includes(thisAnsweredQuestion.questionSequence)) {
this.foundDuplicateQuestions[thisGlassPart].push(thisAnsweredQuestion.questionSequence);
@@ -294,7 +294,7 @@ export default {
}
// are there any questions left that are not suppressed?
- const remainingQuestions = glassPart.questions.filter((q) => {
+ const remainingQuestions = glass.questions.filter((q) => {
return !q.suppressQuestion;
});
@@ -309,13 +309,13 @@ export default {
suppressQuestion: pq.suppressQuestion,
};
// set the answerData as 'already answered'
- glassPart.answerData = {
+ glass.answerData = {
answerResult: matchedAnswer.nextQuestionSequence ? matchedAnswer.nextQuestionSequence : matchedAnswer.answerResult,
answeredQuestions: [answeredQuestionObj],
};
- // suppress this glassPart because it has an answer
- glassPart.isSuppressedPart = true;
+ // suppress this glass because it has an answer
+ glass.isSuppressedPart = true;
}
}
@@ -343,9 +343,9 @@ export default {
// "glassPart2": [7, 10]
// };
- const thisPartsDupes = this.foundDuplicateQuestions["glassPart" + answer.glassPartIndex];
+ const thisPartsDupes = this.foundDuplicateQuestions["glass" + answer.glassIndex];
const completeAnsweredQuestions = answer.answeredQuestions ? [...answer.answeredQuestions] : [];
- const glassPartAnswered = this.partsQuestionsData[answer.glassPartIndex];
+ const glassPartAnswered = this.partsQuestionsData[answer.glassIndex];
thisPartsDupes?.forEach((dupe) => {
// dupe is a single integer
@@ -396,7 +396,7 @@ export default {
}
// this part has been fully answered, so advance to next part's question chain
- for (let i = answer.glassPartIndex + 1; i < this.partsQuestionsData.length; i++) {
+ for (let i = answer.glassIndex + 1; i < this.partsQuestionsData.length; i++) {
// if this part has not yet been fully answered, then make it the current part
if (!this.partsQuestionsData[i].answerData?.answerResult) {
this.currentPartNum = i;
@@ -410,14 +410,14 @@ export default {
// are there alreadyAnsweredQuestions?
const alreadyAnsweredQuestions = store.getters.damage.partQuestionAnswers;
- this.partsQuestionsData = this.pageData.partsOrQuestions.filter(x => x.partQuestions).map((glassPart, i) => {
- glassPart.key = glassPart.glassLocation + "-" + glassPart.glassName;
+ this.partsQuestionsData = this.pageData.partsOrQuestions.filter(x => x.partQuestions).map((glass, i) => {
+ glass.key = glass.glassLocation + "-" + glass.glassName;
// NOTE: property "questions" can differ between layouts
- glassPart.questions = glassPart.partQuestions;
+ glass.questions = glass.partQuestions;
- this.selectedAnswers[glassPart.key] = [];
+ this.selectedAnswers[glass.key] = [];
if (!alreadyAnsweredQuestions) {
- glassPart.answerData = null;
+ glass.answerData = null;
}
alreadyAnsweredQuestions?.forEach((savedPart) => {
@@ -425,7 +425,7 @@ export default {
if (!savedPart.glassLocation || !savedPart.glassName || !savedPart.answeredQuestions || !savedPart.result) {
return;
}
- if (glassPart.glassLocation === savedPart.glassLocation && glassPart.glassName === savedPart.glassName) {
+ if (glass.glassLocation === savedPart.glassLocation && glass.glassName === savedPart.glassName) {
let answerString = "";
// matches; loop through answeredQuestions for matches
@@ -434,7 +434,7 @@ export default {
return;
}
// determine which answer was previously chosen
- const theAns = glassPart.questions[aq.questionNum-1].answers.find((a) => {
+ const theAns = glass.questions[aq.questionNum-1].answers.find((a) => {
return a.answerText.toUpperCase() === aq.selectedAnswerText.toUpperCase();
});
if (theAns.nextQuestionSequence) {
@@ -444,18 +444,18 @@ export default {
}
// mark this question as answered (question-chain will read this)
- glassPart.questions[aq.questionNum-1].answerSelected = answerString;
+ glass.questions[aq.questionNum-1].answerSelected = answerString;
// mark this question as duplicate if it is (question-chain will read this)
if (aq.suppressQuestion) {
- glassPart.questions[aq.questionNum-1].suppressQuestion = true;
+ glass.questions[aq.questionNum-1].suppressQuestion = true;
}
});
// advance the currentPartNum
this.currentPartNum = i;
- // add answerData to current glassPart
- glassPart.answerData = {
+ // add answerData to current glass
+ glass.answerData = {
answerResult: savedPart.result,
answeredQuestions: savedPart.answeredQuestions
}
@@ -463,14 +463,14 @@ export default {
});
- // Set up watch for each set of glassPart questions, which gets updated when all questions for a glassPart have been answered
- this.$watch("selectedAnswers." + glassPart.key, (newValue) => {
+ // Set up watch for each set of glass questions, which gets updated when all questions for a glass have been answered
+ this.$watch("selectedAnswers." + glass.key, (newValue) => {
if (newValue) {
- this.handleAnswerUpdates(glassPart.key, newValue);
+ this.handleAnswerUpdates(glass.key, newValue);
}
}, {deep: true})
- return glassPart;
+ return glass;
});
},