Merge branch 'hotfix/deleted-survey-answers' into develop

This commit is contained in:
Ramon Wenger 2021-03-03 21:54:37 +01:00
commit 271b517fdc
4 changed files with 177 additions and 174 deletions

View File

@ -19008,9 +19008,9 @@
} }
}, },
"survey-vue": { "survey-vue": {
"version": "1.5.18", "version": "1.8.33",
"resolved": "https://registry.npmjs.org/survey-vue/-/survey-vue-1.5.18.tgz", "resolved": "https://registry.npmjs.org/survey-vue/-/survey-vue-1.8.33.tgz",
"integrity": "sha512-DJURzwbCmVgcW2YTM/L9+8J8AgfRffqbPygYY9eXtf5UR4YVAX0wGcVzmcnqwHnjxCw4sX5DW1UDLzXRBtgGWQ==", "integrity": "sha512-ffsYmW8AJCiAyJiNAaZtDxAxYoaSiZCVZQHoAVFcK8IZCuKa2gPYpbZEnC2ytK0WjJ84XdZo+/TcLNU6DnlneQ==",
"requires": { "requires": {
"vue": "^2.1.10" "vue": "^2.1.10"
} }

View File

@ -69,7 +69,7 @@
"sass-loader": "^7.1.0", "sass-loader": "^7.1.0",
"semver": "^5.3.0", "semver": "^5.3.0",
"shelljs": "^0.7.6", "shelljs": "^0.7.6",
"survey-vue": "^1.5.18", "survey-vue": "^1.8.32",
"uglifyjs-webpack-plugin": "^1.1.1", "uglifyjs-webpack-plugin": "^1.1.1",
"unfetch": "^3.1.1", "unfetch": "^3.1.1",
"uploadcare-widget": "^3.6.0", "uploadcare-widget": "^3.6.0",

View File

@ -90,7 +90,6 @@
return 'document' in this.userInput; return 'document' in this.userInput;
}, },
showSpellcheckButton() { showSpellcheckButton() {
console.log(process.env.VUE_APP_ENABLE_SPELLCHECK);
return this.spellcheck && process.env.VUE_APP_ENABLE_SPELLCHECK; return this.spellcheck && process.env.VUE_APP_ENABLE_SPELLCHECK;
}, },
spellcheckText() { spellcheckText() {

View File

@ -47,6 +47,7 @@ export default {
me: { me: {
permissions: [] permissions: []
}, },
saveDisabled: false
}; };
}, },
@ -101,10 +102,10 @@ export default {
} }
survey.data = flatAnswers; survey.data = flatAnswers;
const saveSurvey = (sender, options) => { const saveSurvey = (sender) => {
// sender.clear(false); if (this.saveDisabled) {
// return;
// sender.mode = 'display'; }
this.completed = true; this.completed = true;
@ -119,15 +120,16 @@ export default {
}; };
} }
} }
const answer = {
surveyId: this.id,
data: JSON.stringify(data)
};
this.$apollo.mutate({ this.$apollo.mutate({
mutation: UPDATE_ANSWER, mutation: UPDATE_ANSWER,
variables: { variables: {
input: { input: {
answer: { answer
surveyId: this.id,
data: JSON.stringify(data)
}
} }
}, },
// fixme: make the update work instead of refetching // fixme: make the update work instead of refetching
@ -153,10 +155,12 @@ export default {
return survey; return survey;
}, },
reopen() { reopen() {
this.saveDisabled = true; // disable saving, because resetting triggers a page change which we don't want to save
this.completed = false; this.completed = false;
let data = this.survey.data; // save the data let data = this.survey.data; // save the data
this.survey.clear(); this.survey.clear();
this.survey.data = data; // reapply it this.survey.data = data; // reapply it
this.saveDisabled = false;
} }
}, },