Merge branch 'hotfix/deleted-survey-answers' into develop
This commit is contained in:
commit
271b517fdc
|
|
@ -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"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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",
|
||||||
|
|
|
||||||
|
|
@ -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() {
|
||||||
|
|
|
||||||
|
|
@ -15,22 +15,22 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as SurveyVue from 'survey-vue';
|
import * as SurveyVue from 'survey-vue';
|
||||||
import {css} from '@/survey.config';
|
import {css} from '@/survey.config';
|
||||||
|
|
||||||
import SURVEY_QUERY from '@/graphql/gql/surveyQuery.gql';
|
import SURVEY_QUERY from '@/graphql/gql/surveyQuery.gql';
|
||||||
import MODULE_QUERY from '@/graphql/gql/moduleByIdQuery.gql';
|
import MODULE_QUERY from '@/graphql/gql/moduleByIdQuery.gql';
|
||||||
import UPDATE_ANSWER from '@/graphql/gql/mutations/updateAnswer.gql';
|
import UPDATE_ANSWER from '@/graphql/gql/mutations/updateAnswer.gql';
|
||||||
import Solution from '@/components/content-blocks/Solution';
|
import Solution from '@/components/content-blocks/Solution';
|
||||||
|
|
||||||
import {extractSurveySolutions} from '@/helpers/survey-solutions';
|
import {extractSurveySolutions} from '@/helpers/survey-solutions';
|
||||||
import {isTeacher} from '@/helpers/is-teacher';
|
import {isTeacher} from '@/helpers/is-teacher';
|
||||||
|
|
||||||
import {meQuery} from '@/graphql/queries';
|
import {meQuery} from '@/graphql/queries';
|
||||||
|
|
||||||
const Survey = SurveyVue.Survey;
|
const Survey = SurveyVue.Survey;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['id'],
|
props: ['id'],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -195,14 +199,14 @@ export default {
|
||||||
},
|
},
|
||||||
me: meQuery
|
me: meQuery
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@import "@/styles/_variables.scss";
|
@import "@/styles/_variables.scss";
|
||||||
@import "@/styles/_mixins.scss";
|
@import "@/styles/_mixins.scss";
|
||||||
|
|
||||||
.survey-page {
|
.survey-page {
|
||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: auto 1fr;
|
grid-template-rows: auto 1fr;
|
||||||
|
|
@ -216,5 +220,5 @@ export default {
|
||||||
@include meta-title;
|
@include meta-title;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue