X-Git-Url: https://git.auder.net/?p=qomet.git;a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Fstatements.js;h=5bf6bdb7a04c959039f3855ecca745dc00dee931;hp=6ebea85f1c94b55d1a7cd6f3083afe6ec16c1456;hb=71d1ca9c594b64d959c608a2abbff926480abad5;hpb=f6648c37a3c13efbbc3b8c03c6ff725984c98843 diff --git a/public/javascripts/components/statements.js b/public/javascripts/components/statements.js index 6ebea85..5bf6bdb 100644 --- a/public/javascripts/components/statements.js +++ b/public/javascripts/components/statements.js @@ -11,7 +11,7 @@ Vue.component("statements", { // Full questions tree is rendered, but some parts hidden depending on display settings render(h) { // TODO: render nothing if answers is empty - let domTree = this.questions.map( (q,i) => { + let domTree = (this.questions || [ ]).map( (q,i) => { let questionContent = [ ]; questionContent.push( h( @@ -70,7 +70,7 @@ Vue.component("statements", { "class": { option: true, choiceCorrect: this.answers.showSolution && this.questions[i].answer.includes(idx), - choiceWrong: this.answers.showSolution && this.inputs[i][idx] && !q.answer.includes(idx), + choiceWrong: this.answers.showSolution && this.answers.inputs[i][idx] && !q.answer.includes(idx), }, }, option @@ -93,7 +93,7 @@ Vue.component("statements", { { "class": { "question": true, - "hide": !this.answers.displayAll && this.answers.index != i, + "hide": !this.answers.displayAll && this.answers.indices[this.answers.index] != i, }, }, questionContent @@ -106,7 +106,7 @@ Vue.component("statements", { id: "statements", }, }, - questions + domTree ); }, updated: function() {