X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fmonitor.js;h=6ee6a410fbc5cc7e696e4594e65a0ff8a2e4bfd7;hb=f87ac54a07e9cc63a28b8eae42fa6ab23ac626d0;hp=1b8d62f9f8573343c07714d82187d878d56d9972;hpb=2bada710d28ffe9f45b150e5744b43af83e93d99;p=qomet.git diff --git a/public/javascripts/monitor.js b/public/javascripts/monitor.js index 1b8d62f..6ee6a41 100644 --- a/public/javascripts/monitor.js +++ b/public/javascripts/monitor.js @@ -42,6 +42,25 @@ new Vue({ groupId: function(group, prefix) { return (prefix || "") + "group" + group; }, + togglePresence: function(student) { + const sIdx = this.students.findIndex( s => { return s.number == student.number; }); + Vue.set( this.students, sIdx, Object.assign({},student,{present:!student.present}) ); + //s.present = !s.present; + }, + allFinished: function() { + for (s of this.students) + { + if (!s.present) + continue; + const paperIdx = this.assessment.papers.findIndex( item => { return item.number == s.number; }); + if (paperIdx === -1) + return false; + const paper = this.assessment.papers[paperIdx]; + if (paper.inputs.length < this.assessment.questions.length) + return false; + } + return true; + }, getColor: function(number, qIdx) { // For the moment, green if correct and red if wrong; grey if unanswered yet // TODO: in-between color for partially right (especially for multi-questions) @@ -82,6 +101,7 @@ new Vue({ return input; }); this.students = s.students; + this.students.forEach( s => { s.present = true; }); //a priori... this.stage = 1; socket = io.connect("/", { query: "aid=" + this.assessment._id + "&secret=" + s.secret