X-Git-Url: https://git.auder.net/?p=qomet.git;a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Fstatements.js;h=86138c00a2d2c7e72a6b5aff591756a9c41ead77;hp=824ce76a9b13959dfd9c8e90685d3725fc1c8456;hb=14c9c66a3bc1abfeb3097a0c9fe4f0ff25fe2b8b;hpb=a3080c337cfaca9d600911396cae5a9233d43554 diff --git a/public/javascripts/components/statements.js b/public/javascripts/components/statements.js index 824ce76..86138c0 100644 --- a/public/javascripts/components/statements.js +++ b/public/javascripts/components/statements.js @@ -26,10 +26,11 @@ Vue.component("statements", { // 'inputs': object with key = question index and value = text or boolean array // display: 'all', 'one', 'solution' // iidx: current level-0 integer index (can match a group of questions / inputs) - props: ['questions','inputs','display','iidx'], + props: ['questions','inputs','answers','display','iidx'], data: function() { return { displayStyle: "compact", //or "all": all on same page + parameters: 0, //TODO: DO NOT re-draw parameters for already answered questions }; } // Full questions tree is rendered, but some parts hidden depending on display settings @@ -120,14 +121,15 @@ Vue.component("statements", { } ) ); + const aIdx = (this.answers || [ ]).findIndex( item => { return item.index == q.index; }); optionList.push( h( "div", { "class": { option: true, - choiceCorrect: this.display == "solution" && q.answer.includes(idx), - choiceWrong: this.display == "solution" && !!this.inputs && this.inputs[q.index][idx] && !q.answer.includes(idx), + choiceCorrect: this.display == "solution" && this.answers[aIdx].includes(idx), + choiceWrong: this.display == "solution" && !!this.inputs && this.inputs[q.index][idx] && !this.answers[aIdx].includes(idx), }, }, option @@ -146,6 +148,10 @@ Vue.component("statements", { ) ); } + else + { + // Open question, or parameterized: TODO + } const depth = (q.index.match(/\./g) || []).length; return h( "div",