Skip to content

Commit

Permalink
Partial Save of SubQuestions
Browse files Browse the repository at this point in the history
  • Loading branch information
datajohnson committed Mar 13, 2024
1 parent c9c8e25 commit 9cae3c8
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/web/src/components/QuestionRenderer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
hide-details
:value="ch.val"
density="compact"
@update:model-value="$emit('answerChanged', 1)"
@update:model-value="subUpdated(sub)"
style="width: 30px" />
</td>
</tr>
Expand Down Expand Up @@ -190,6 +190,16 @@ export default {
let value = JSON.parse(val);
let q = this.question;
if (q.subQuestions) {
for (let sq of q.subQuestions) {
let subStorage = `${sq.QID}_ANSWER`;
let sqVal = localStorage.getItem(subStorage);
let sqValue = JSON.parse(sqVal);
if (sqValue) sq.answer = sqValue.value;
}
}
nextTick(() => {
if (value) q.answer = value.value;
});
Expand All @@ -202,6 +212,11 @@ export default {
},
data: () => ({}),
methods: {
subUpdated(subQ) {
localStorage.setItem(`${subQ.QID}_ANSWER`, JSON.stringify({ value: subQ.answer }));
this.$emit("answerChanged", subQ.answer);
},
checkCustom() {
if (this.selectedOption && this.selectedOption.allow_custom && this.selectedOption.allow_custom == "true") {
this.showCustomField = true;
Expand Down

0 comments on commit 9cae3c8

Please sign in to comment.