Commit | Line | Data |
---|---|---|
e99c53fb BA |
1 | // TODO: onglets pour chaque groupe + section déroulante questionnaire (chargé avec réponses) |
2 | // NOM Prenom (par grp, puis alphabétique) | |
3 | // réponse : vert si OK (+ choix), rouge si faux, gris si texte (clic pour voir) | |
4 | // + temps total ? | |
5 | // click sur en-tête de colonne : tri alphabétique, tri décroissant... | |
6 | // Affiché si (hash du) mdp du cours est correctement entré | |
7 | // Doit reprendre les données en base si refresh (sinon : sockets) | |
8 | ||
9 | // Also buttons "start exam", "end exam" for logged in teacher | |
e5ec7dea | 10 | |
e5ec7dea BA |
11 | let socket = null; //monitor answers in real time |
12 | ||
e5ec7dea BA |
13 | new Vue({ |
14 | el: "#monitor", | |
15 | data: { | |
16 | password: "", //from password field | |
17 | assessment: null, //obtained after authentication | |
18 | // Stage 0: unauthenticated (password), | |
19 | // 1: authenticated (password hash validated), start monitoring | |
20 | stage: 0, | |
21 | }, | |
e5ec7dea BA |
22 | methods: { |
23 | // stage 0 --> 1 | |
24 | startMonitoring: function() { | |
25 | $.ajax("/start/monitoring", { | |
26 | method: "GET", | |
27 | data: { | |
28 | password: this., | |
29 | aname: examName, | |
30 | cname: courseName, | |
31 | }, | |
32 | dataType: "json", | |
33 | success: s => { | |
34 | if (!!s.errmsg) | |
35 | return this.warning(s.errmsg); | |
36 | this.stage = 1; | |
37 | }, | |
38 | }); | |
39 | }, | |
40 | // TODO: 2-level sockets, for prof and monitors | |
41 | socket = io.connect("/" + assessment.name, { | |
42 | query: "number=" + this.student.number + "&password=" + this.password | |
43 | }); | |
44 | socket.on(message.allAnswers, this.setAnswers); | |
45 | initializeStage2(s.questions, s.paper); | |
46 | }, | |
47 | }); | |
48 | }, | |
49 | // stage 2 --> 3 (or 4) | |
50 | // from a message by statements component, or time over | |
51 | // TODO: also function startAssessment (for main teacher only) | |
52 | endAssessment: function() { | |
53 | // Set endTime, destroy password | |
54 | $("#leftButton, #rightButton").show(); | |
55 | if (assessment.mode == "open") | |
56 | { | |
57 | this.stage = 4; | |
58 | return; | |
59 | } | |
60 | $.ajax("/end/assessment", { | |
61 | method: "GET", | |
62 | data: { | |
63 | aid: assessment._id, | |
64 | number: this.student.number, | |
65 | password: this.student.password, | |
66 | }, | |
67 | dataType: "json", | |
68 | success: ret => { | |
69 | if (!!ret.errmsg) | |
70 | return this.warning(ret.errmsg); | |
71 | assessment.conclusion = ret.conclusion; | |
72 | this.stage = 3; | |
73 | delete this.student["password"]; //unable to send new answers now | |
74 | socket.disconnect(); | |
75 | socket = null; | |
76 | }, | |
77 | }); | |
78 | }, | |
79 | }, | |
80 | }); |