From fa6abf40b7afdbff4b9dc5fb143e29db512bf8c5 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Mon, 5 Feb 2018 00:55:16 +0100
Subject: [PATCH] Fix answers display on monitor page

---
 TODO                          | 1 +
 public/javascripts/monitor.js | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/TODO b/TODO
index 8670fcb..2c7a5b2 100644
--- a/TODO
+++ b/TODO
@@ -5,6 +5,7 @@ time per question (in mode "one question at a time" from server...)
 compute grades after exam (in teacher's view)
 factorize redundant code in course.js, monitor.js and (TOWRITE) grade.js
   (showing students list + grades or papers)
+monitoring: main teacher should not be asked for pwd, and button "send feedback" hidden for others
 
 -----
 
diff --git a/public/javascripts/monitor.js b/public/javascripts/monitor.js
index 6c08d7a..07a0814 100644
--- a/public/javascripts/monitor.js
+++ b/public/javascripts/monitor.js
@@ -81,7 +81,11 @@ new Vue({
 					if (!!s.errmsg)
 						return alert(s.errmsg);
 					this.assessment = s.assessment;
-					this.answers.inputs = s.assessment.questions.map( q => { return q.answer; });
+					this.answers.inputs = s.assessment.questions.map( q => {
+						let input = _(q.options.length).times( _.constant(false) );
+						q.answer.forEach( idx => { input[idx] = true; });
+						return input;
+					});
 					this.students = s.students;
 					this.stage = 1;
 					socket = io.connect("/", {
-- 
2.44.0