Clean up code

This commit is contained in:
Ramon Wenger 2019-07-04 10:24:12 +02:00
parent b498dc4efa
commit e296d500aa
2 changed files with 3 additions and 7 deletions

View File

@ -23,7 +23,6 @@
data() {
return {
// survey
survey: this.initSurvey(),
title: ''
}
@ -35,7 +34,6 @@
survey.data = answer;
survey.onComplete.add((sender, options) => {
console.log(survey.data);
sender.clear(false);
sender.mode = 'display';
@ -70,14 +68,12 @@
manual: true,
result({data, loading, networkStatus}) {
if (!loading) {
console.log(data);
let json = JSON.parse(data.survey.data);
let answer = {};
if (data.survey.answer && data.survey.answer.data) {
answer = JSON.parse(data.survey.answer.data);
}
console.log(json);
this.survey = this.initSurvey(json, answer);
this.title = data.survey.title;
}

View File

@ -58,9 +58,9 @@ def get_graphql_mutation(filename):
def get_by_id(model, **kwargs):
id = kwargs.get('id')
if id is not None:
return get_object(model, id)
return None
return get_object(model, id) if id is not None else None
def get_by_id_or_slug(model, **kwargs):
slug = kwargs.get('slug')