Merge branch 'hotfix/deleted-survey-answers' into develop
This commit is contained in:
commit
271b517fdc
|
|
@ -19008,9 +19008,9 @@
|
|||
}
|
||||
},
|
||||
"survey-vue": {
|
||||
"version": "1.5.18",
|
||||
"resolved": "https://registry.npmjs.org/survey-vue/-/survey-vue-1.5.18.tgz",
|
||||
"integrity": "sha512-DJURzwbCmVgcW2YTM/L9+8J8AgfRffqbPygYY9eXtf5UR4YVAX0wGcVzmcnqwHnjxCw4sX5DW1UDLzXRBtgGWQ==",
|
||||
"version": "1.8.33",
|
||||
"resolved": "https://registry.npmjs.org/survey-vue/-/survey-vue-1.8.33.tgz",
|
||||
"integrity": "sha512-ffsYmW8AJCiAyJiNAaZtDxAxYoaSiZCVZQHoAVFcK8IZCuKa2gPYpbZEnC2ytK0WjJ84XdZo+/TcLNU6DnlneQ==",
|
||||
"requires": {
|
||||
"vue": "^2.1.10"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
"sass-loader": "^7.1.0",
|
||||
"semver": "^5.3.0",
|
||||
"shelljs": "^0.7.6",
|
||||
"survey-vue": "^1.5.18",
|
||||
"survey-vue": "^1.8.32",
|
||||
"uglifyjs-webpack-plugin": "^1.1.1",
|
||||
"unfetch": "^3.1.1",
|
||||
"uploadcare-widget": "^3.6.0",
|
||||
|
|
|
|||
|
|
@ -90,7 +90,6 @@
|
|||
return 'document' in this.userInput;
|
||||
},
|
||||
showSpellcheckButton() {
|
||||
console.log(process.env.VUE_APP_ENABLE_SPELLCHECK);
|
||||
return this.spellcheck && process.env.VUE_APP_ENABLE_SPELLCHECK;
|
||||
},
|
||||
spellcheckText() {
|
||||
|
|
|
|||
|
|
@ -15,22 +15,22 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import * as SurveyVue from 'survey-vue';
|
||||
import {css} from '@/survey.config';
|
||||
import * as SurveyVue from 'survey-vue';
|
||||
import {css} from '@/survey.config';
|
||||
|
||||
import SURVEY_QUERY from '@/graphql/gql/surveyQuery.gql';
|
||||
import MODULE_QUERY from '@/graphql/gql/moduleByIdQuery.gql';
|
||||
import UPDATE_ANSWER from '@/graphql/gql/mutations/updateAnswer.gql';
|
||||
import Solution from '@/components/content-blocks/Solution';
|
||||
import SURVEY_QUERY from '@/graphql/gql/surveyQuery.gql';
|
||||
import MODULE_QUERY from '@/graphql/gql/moduleByIdQuery.gql';
|
||||
import UPDATE_ANSWER from '@/graphql/gql/mutations/updateAnswer.gql';
|
||||
import Solution from '@/components/content-blocks/Solution';
|
||||
|
||||
import {extractSurveySolutions} from '@/helpers/survey-solutions';
|
||||
import {isTeacher} from '@/helpers/is-teacher';
|
||||
import {extractSurveySolutions} from '@/helpers/survey-solutions';
|
||||
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'],
|
||||
|
||||
components: {
|
||||
|
|
@ -47,6 +47,7 @@ export default {
|
|||
me: {
|
||||
permissions: []
|
||||
},
|
||||
saveDisabled: false
|
||||
};
|
||||
},
|
||||
|
||||
|
|
@ -101,10 +102,10 @@ export default {
|
|||
}
|
||||
survey.data = flatAnswers;
|
||||
|
||||
const saveSurvey = (sender, options) => {
|
||||
// sender.clear(false);
|
||||
//
|
||||
// sender.mode = 'display';
|
||||
const saveSurvey = (sender) => {
|
||||
if (this.saveDisabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.completed = true;
|
||||
|
||||
|
|
@ -119,15 +120,16 @@ export default {
|
|||
};
|
||||
}
|
||||
}
|
||||
const answer = {
|
||||
surveyId: this.id,
|
||||
data: JSON.stringify(data)
|
||||
};
|
||||
|
||||
this.$apollo.mutate({
|
||||
mutation: UPDATE_ANSWER,
|
||||
variables: {
|
||||
input: {
|
||||
answer: {
|
||||
surveyId: this.id,
|
||||
data: JSON.stringify(data)
|
||||
}
|
||||
answer
|
||||
}
|
||||
},
|
||||
// fixme: make the update work instead of refetching
|
||||
|
|
@ -153,10 +155,12 @@ export default {
|
|||
return survey;
|
||||
},
|
||||
reopen() {
|
||||
this.saveDisabled = true; // disable saving, because resetting triggers a page change which we don't want to save
|
||||
this.completed = false;
|
||||
let data = this.survey.data; // save the data
|
||||
this.survey.clear();
|
||||
this.survey.data = data; // reapply it
|
||||
this.saveDisabled = false;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -195,14 +199,14 @@ export default {
|
|||
},
|
||||
me: meQuery
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import "@/styles/_variables.scss";
|
||||
@import "@/styles/_mixins.scss";
|
||||
@import "@/styles/_variables.scss";
|
||||
@import "@/styles/_mixins.scss";
|
||||
|
||||
.survey-page {
|
||||
.survey-page {
|
||||
max-width: 800px;
|
||||
display: grid;
|
||||
grid-template-rows: auto 1fr;
|
||||
|
|
@ -216,5 +220,5 @@ export default {
|
|||
@include meta-title;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue