Bugs fixes
authorBenjamin Auder <benjamin.auder@somewhere>
Mon, 5 Feb 2018 14:10:37 +0000 (15:10 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Mon, 5 Feb 2018 14:10:37 +0000 (15:10 +0100)
TODO
public/javascripts/assessment.js
public/javascripts/components/statements.js
public/stylesheets/assessment.css
views/assessment.pug

diff --git a/TODO b/TODO
index 73f669e..2c7a5b2 100644 (file)
--- 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 )
 
index 09caf12..9858643 100644 (file)
@@ -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;
                },
        },
index 5bf6bdb..8cfbde3 100644 (file)
@@ -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.
index 2143f40..26d9d75 100644 (file)
@@ -4,7 +4,7 @@ a#rightButton {
        right: 0;
 }
 
-button#sendAnswer {
+button.sendAnswer {
        display: block;
        margin: 0 auto;
 }
index 26221d8..5c573d7 100644 (file)
@@ -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 &#9786; ...don't close the window!