From: Benjamin Auder <benjamin.auder@somewhere> Date: Mon, 5 Feb 2018 14:10:37 +0000 (+0100) Subject: Bugs fixes X-Git-Url: https://git.auder.net/variants/img/pieces/scripts/doc/html/index.html?a=commitdiff_plain;h=3b8117c51c644b050b87811f1a923f6b7e5b7916;p=qomet.git Bugs fixes --- diff --git a/TODO b/TODO index 73f669e..2c7a5b2 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ -Debug exam mode (and open too...): Vue.js warning + shift questions (not showing solution) - Replace underscore by lodash (or better: ES6) Replace socket.io by Websockets ( https://www.npmjs.com/package/websocket ) diff --git a/public/javascripts/assessment.js b/public/javascripts/assessment.js index 09caf12..9858643 100644 --- a/public/javascripts/assessment.js +++ b/public/javascripts/assessment.js @@ -129,7 +129,8 @@ let V = new Vue({ this.answers.indices = indices.concat( _.shuffle(remainingIndices) ); } this.answers.index = !!paper ? paper.inputs.length : 0; - Vue.nextTick(statementsLibsRefresh); + this.answers.displayAll = assessment.display == "all"; + this.answers.showSolution = false; this.stage = 2; }; if (assessment.mode == "open") @@ -223,6 +224,7 @@ let V = new Vue({ if (assessment.mode == "open") { this.stage = 4; + this.answers.showSolution = true; return; } $.ajax("/end/assessment", { @@ -248,6 +250,7 @@ let V = new Vue({ setAnswers: function(m) { for (let i=0; i<m.answers.length; i++) assessment.questions[i].answer = m.answers[i]; + this.answers.showSolution = true; this.stage = 4; }, }, diff --git a/public/javascripts/components/statements.js b/public/javascripts/components/statements.js index 5bf6bdb..8cfbde3 100644 --- a/public/javascripts/components/statements.js +++ b/public/javascripts/components/statements.js @@ -109,6 +109,9 @@ Vue.component("statements", { domTree ); }, + mounted: function() { + statementsLibsRefresh(); + }, updated: function() { // TODO: next line shouldn't be required: questions wordings + answer + options // are processed earlier; their content should be updated at this time. diff --git a/public/stylesheets/assessment.css b/public/stylesheets/assessment.css index 2143f40..26d9d75 100644 --- a/public/stylesheets/assessment.css +++ b/public/stylesheets/assessment.css @@ -4,7 +4,7 @@ a#rightButton { right: 0; } -button#sendAnswer { +button.sendAnswer { display: block; margin: 0 auto; } diff --git a/views/assessment.pug b/views/assessment.pug index 26221d8..5c573d7 100644 --- a/views/assessment.pug +++ b/views/assessment.pug @@ -44,11 +44,13 @@ block content .introduction(v-html="assessment.introduction") #stage2_4(v-if="[2,4].includes(stage)") if assessment.time > 0 - .card(v-if="stage==2") + .card(v-show="stage==2") .timer.center {{ countdown }} .card - button#sendAnswer.waves-effect.waves-light.btn(@click="sendAnswer") Send + button.sendAnswer.waves-effect.waves-light.btn(@click="sendAnswer") Send statements(:questions="assessment.questions" :answers="answers") + if assessment.display == "all" + button.sendAnswer.waves-effect.waves-light.btn(@click="sendAnswer") Send #stage3(v-show="stage==3") .card .finish Exam completed ☺ ...don't close the window!