Fix send button when assessment.display == 'all'
authorBenjamin Auder <benjamin.auder@somewhere>
Mon, 5 Feb 2018 14:15:08 +0000 (15:15 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Mon, 5 Feb 2018 14:15:08 +0000 (15:15 +0100)
public/javascripts/assessment.js

index 9858643..faf159c 100644 (file)
@@ -181,7 +181,7 @@ let V = new Vue({
                        }, 1000);
                },
                // stage 2
-               sendAnswer: function() {
+               sendOneAnswer: function() {
                        const realIndex = this.answers.indices[this.answers.index];
                        let gotoNext = () => {
                                if (this.answers.index == assessment.questions.length - 1)
@@ -216,6 +216,13 @@ let V = new Vue({
                                },
                        });
                },
+               // TODO: I don't like that + sending should not be definitive in exam mode with display = all
+               sendAnswer: function() {
+                       if (assessment.display == "one")
+                               sendOneAnswer();
+                       else
+                               assessment.questions.forEach(sendOneAnswer);
+               },
                // stage 2 --> 3 (or 4)
                // from a message by statements component, or time over
                endAssessment: function() {