Merge pull request #740 from Safelite/feature/CSR-803-refactoring-2

Feature/CSR-803 refactoring 2
This commit is contained in:
AdamCaouetteSafelite 2022-09-14 16:27:34 -04:00 committed by GitHub
commit 275fa72735
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 11 deletions

View file

@ -7,7 +7,7 @@
:class="(q.questionSequence === currentQuestionNum) && 'current-question'"
:questionText="q.questionText"
:answers="q.answers"
:groupName="`${keyString}-${q.questionSequence}`"
:groupName="`question-${glassIndex}-${q.questionSequence}`"
v-model="q.answerSelected"
@isCheckedChanged="handleAnswer"
isRequired
@ -34,19 +34,16 @@ export default {
validationRules: String,
modelValue: Array,
glassIndex: Number,
keyString: String,
},
async created() {
// validate form upon create to prevent out of sync / persistent valid states
await useValidateForm(); // do a test validation check, without triggering full validation
// do a test validation check upon create to prevent out of sync / incorrect valid states
await useValidateForm(); // NOTE: needs to have async/await here; tested and won't work without it
this.questionData.map((q, i) => {
let answerPair = [];
const question = {
questionText: q.questionText,
questionSequence: q.questionSequence,
answers: q.answers.map((a) => {
answerPair.push(a.nextQuestionSequence ? a.nextQuestionSequence : a.answerResult);
return {
Text: a.answerText,
// Name will either be nextQuestionSequence or answerResult
@ -65,7 +62,6 @@ export default {
}),
answerSelected: q.answerSelected || "",
};
question.answerPair = answerPair;
if (!q.suppressQuestion) {
this.questions.push(question);
}

View file

@ -10,7 +10,7 @@
:manualHeadline="AlertFewMoreQuestionsHeader" :manualCopy="AlertFewMoreQuestionsCopy"
v-bind:isDismissible="false" />
<div v-for="(glass, i) in capabilityQuestionsData" :key="glass.key">
<questionChain ref="questionChain" :keyString="glass.key"
<questionChain ref="questionChain"
v-model="selectedAnswers[glass.glassLocation + '-' + glass.glassName]"
:questionData="glass.capabilityQuestions" :glassIndex="i"
v-if="showThisQuestionChain(glass, i)"

View file

@ -23,7 +23,6 @@
<div v-for="(glass, i) in moldingQuestionsData" :key="glass.key">
<questionChain
ref="questionChain"
:keyString="glass.key"
v-model="selectedAnswers[glass.glassLocation + '-' + glass.glassName]"
:questionData="glass.questions"
:glassIndex="i"

View file

@ -23,7 +23,6 @@
<div v-for="(glass, i) in partsQuestionsData" :key="glass.key">
<questionChain
ref="questionChain"
:keyString="glass.key"
v-model="selectedAnswers[glass.glassLocation + '-' + glass.glassName]"
:questionData="glass.questions"
:glassIndex="i"

View file

@ -10,7 +10,7 @@ export default {
if (!store.getters.applicationUser.savedSessionId) {
saveOrder();
}
const result = await this.dispatchStoreAction(storeActions.GET_PARTS_OR_QUESTIONS);
const partsOrQuestions = result.data.partsOrQuestions;