From: Benjamin Auder <benjamin.auder@somewhere>
Date: Mon, 5 Feb 2018 14:15:08 +0000 (+0100)
Subject: Fix send button when assessment.display == 'all'
X-Git-Url: https://git.auder.net/%7B%7B%20asset%28%27mixstore/images/vendor/%3C?a=commitdiff_plain;h=9f4f325946b08f8d0dc5509312edbc2ced7231b1;p=qomet.git

Fix send button when assessment.display == 'all'
---

diff --git a/public/javascripts/assessment.js b/public/javascripts/assessment.js
index 9858643..faf159c 100644
--- a/public/javascripts/assessment.js
+++ b/public/javascripts/assessment.js
@@ -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() {