Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Paul-Elliot Anglès d'Auriac
class-panic
Commits
8ca38315
Commit
8ca38315
authored
Nov 03, 2018
by
Paul-Elliot Anglès d'Auriac
Browse files
Fin provisoire du cc coté correcteur !
parent
2838b587
Changes
6
Hide whitespace changes
Inline
Side-by-side
controllers/sockets/socketCCCorrect.js
View file @
8ca38315
...
...
@@ -27,7 +27,7 @@ module.exports = function(io) {
socket
.
use
(
function
(
packet
,
next
)
{
console
.
log
(
"
packet is
"
,
packet
[
0
]);
console
.
log
(
"
arg is
"
,
packet
[
1
],
packet
[
2
]);
//
console.log("arg is", packet[1], packet[2]);
// On vérifie que le TDMan est bien un TDMan
if
(
packet
[
1
])
async
.
waterfall
([
...
...
@@ -62,7 +62,7 @@ module.exports = function(io) {
/******************************************/
socket
.
on
(
'
sendAnswer
'
,
function
(
roomID
,
studentID
,
questionID
)
{
console
.
log
(
"
studentID =
"
,
studentID
);
//
console.log("studentID = ", studentID);
tools
.
sendAnswer
(
socket
,
socket
.
room
,
studentID
,
questionID
,
function
(
err
)
{
if
(
err
)
throw
err
;
});
...
...
@@ -73,22 +73,24 @@ module.exports = function(io) {
/******************************************/
socket
.
on
(
'
setValidity
'
,
function
(
roomID
,
studentID
,
questionID
,
i
,
validity
)
{
console
.
log
(
"
studentID =
"
,
studentID
);
//
console.log("studentID = ", studentID);
tools
.
setValidity
(
socket
.
room
,
studentID
,
questionID
,
i
,
validity
,
function
(
err
)
{
if
(
err
)
throw
err
;
tools
.
sendAnswer
(
socket
,
socket
.
room
,
studentID
,
questionID
,
function
(
err
)
{
if
(
err
)
throw
err
;
});
tools
.
sendListStudents
(
socket
.
request
.
session
.
user
,
socket
,
socket
.
room
,
function
()
{});
// tools.sendAnswer(socket, socket.room, studentID, questionID, function (err) {
// if(err) throw err;
// });
});
});
socket
.
on
(
'
setStrategy
'
,
function
(
roomID
,
studentID
,
questionID
,
strategy
,
mark
)
{
console
.
log
(
"
strategy =
"
,
strategy
);
console
.
log
(
"
mark =
"
,
mark
);
//
console.log("strategy = ", strategy);
//
console.log("mark = ", mark);
Stats
.
setStrategy
(
roomID
,
studentID
,
questionID
,
[
strategy
,
mark
],
(
err
)
=>
{
if
(
err
)
throw
err
;
tools
.
sendAnswer
(
socket
,
socket
.
room
,
studentID
,
questionID
,
function
(
err
)
{
if
(
err
)
throw
err
;
});
tools
.
sendListStudents
(
socket
.
request
.
session
.
user
,
socket
,
socket
.
room
,
function
()
{});
// tools.sendAnswer(socket, socket.room, studentID, questionID, function (err) {
// if(err) throw err;
// });
});
});
...
...
@@ -97,9 +99,9 @@ module.exports = function(io) {
/******************************************/
socket
.
on
(
'
sendList
'
,
function
(
roomID
,
studentID
)
{
console
.
log
(
"
this arg :
"
,
socket
.
room
,
studentID
);
//
console.log("this arg : ", socket.room, studentID);
User
.
userByID
(
studentID
,
(
err
,
user
)
=>
{
console
.
log
(
"
user is
"
,
user
);
//
console.log("user is ",user);
tools
.
sendListQuestion
(
user
,
socket
,
socket
.
room
,
function
()
{});
});
});
...
...
controllers/sockets/tools.js
View file @
8ca38315
...
...
@@ -67,9 +67,9 @@ module.exports = function (io) {
tools
.
sendListQuestion
=
function
(
user
,
socket
,
room
,
callback
)
{
game
.
questionListForCC
(
user
,
room
.
id
,
function
(
err
,
question
)
{
console
.
log
(
"
apres =
"
,
question
);
//
console.log("apres = ", question);
socket
.
emit
(
"
newList
"
,
question
);
console
.
log
(
"
oooooooooooooooo
"
);
//
console.log("oooooooooooooooo");
callback
();
});
};
...
...
models/game.js
View file @
8ca38315
...
...
@@ -39,7 +39,7 @@ exports.questionListForCC = function (user, roomID, callback) {
else
row
.
answered
=
false
;
});
console
.
log
(
"
avant =
"
,
rows
);
//
console.log("avant =", rows);
callback
(
err
,
rows
);
});
};
...
...
@@ -103,7 +103,7 @@ exports.registerAnswerCC = function (user, room, questionIndex, newAnswer, callb
bdd
.
query
(
query
,
[
result
.
room
.
id
,
user
.
id
,
result
.
question
.
id
],
function
(
err
,
answ
)
{
// console.log("err flatStats", err, answ);
if
(
answ
[
0
])
{
console
.
log
(
"
result.question =
"
,
result
.
question
);
//
console.log("result.question = ", result.question);
let
toLog
=
bdd
.
query
(
"
UPDATE `statsBloc` SET `id`= `id` WHERE `roomID`= ? AND `questionID`= ?;
"
+
"
UPDATE `stats` SET `response` = ?, strategy = ?, `correct` = ? WHERE userID = ? AND blocID = ?
"
,
[
room
.
id
,
result
.
question
.
id
,
JSON
.
stringify
(
newAnswer
),
result
.
question
.
strategy
,
Question
.
correctSubmission
(
result
.
question
,
newAnswer
,
result
.
question
.
strategy
),
user
.
id
,
answ
[
0
].
blocID
],
(
err
,
res
)
=>
{
...
...
models/question.js
View file @
8ca38315
...
...
@@ -175,10 +175,10 @@ exports.questionUpdate = function (user, questionID, newQuestion, callback) {
/***********************************************************************/
exports
.
correctSubmission
=
function
(
question
,
submission
,
strategy
)
{
console
.
log
(
"
queztion =
"
,
question
);
console
.
log
(
"
strategy =
"
,
strategy
);
//
console.log("queztion = ", question);
//
console.log("strategy = ", strategy);
// console.log("queztion", question.type);
console
.
log
(
"
submission =
"
,
submission
);
//
console.log("submission = ", submission);
switch
(
/*[*/
strategy
/*, question.strategy]*/
)
{
case
"
manual
"
:
if
(
question
.
mark
)
...
...
@@ -188,20 +188,31 @@ exports.correctSubmission = function(question, submission, strategy) {
let
tot
=
0
;
let
visited
=
[];
submission
.
forEach
((
rep
)
=>
{
if
(
!
visited
[
rep
.
n
])
{
console
.
log
(
"
Myvalidity =
"
,
question
.
reponses
[
rep
.
n
].
validity
);
if
(
!
visited
[
rep
.
n
]
&&
tot
!=
"
unkown
"
)
{
console
.
log
(
"
we are here
"
);
if
(
question
.
reponses
[
rep
.
n
].
validity
==
"
true
"
)
tot
++
;
if
(
question
.
reponses
[
rep
.
n
].
validity
==
"
false
"
)
tot
--
;
if
(
question
.
reponses
[
rep
.
n
].
validity
==
"
to_correct
"
){
console
.
log
(
"
we are there
"
);
tot
=
"
unknown
"
;
}
}
visited
[
rep
.
n
]
=
true
;
});
let
max
=
0
;
question
.
reponses
.
forEach
((
rep
)
=>
{
if
(
rep
.
validity
==
"
true
"
)
if
(
rep
.
validity
==
"
true
"
&&
max
!=
"
unknown
"
)
max
++
;
if
(
rep
.
validity
==
"
to_correct
"
)
max
=
"
unknown
"
;
});
return
""
+
(
tot
*
1
.
/
(
max
?
max
:
1
));
if
(
max
==
"
unknown
"
||
tot
==
"
unknown
"
)
return
"
unknown
"
;
else
return
""
+
(
tot
*
1
.
/
(
max
?
max
:
1
));
case
"
all_or_0
"
:
if
(
!
submission
[
0
])
return
"
0
"
;
...
...
models/stats.js
View file @
8ca38315
...
...
@@ -122,15 +122,35 @@ exports.studentListForCC = function(user, roomID, callback) {
Room
.
getByID
(
roomID
,
(
err
,
room
)
=>
{
console
.
log
(
"
room =
"
,
room
);
Course
.
students
(
room
.
courseID
,
(
err
,
stList
)
=>
{
callback
(
err
,
stList
);
async
.
forEach
(
stList
,
(
student
,
callback
)
=>
{
exports
.
grade
(
student
,
roomID
,
(
err
,
grade
)
=>
{
student
.
grade
=
grade
;
callback
();
});
},
(
err
)
=>
{
callback
(
err
,
stList
);
});
});
// callback(err, []);
});
// let params = [roomID];
// bdd.query(query, params, (err, rows) => {
// console.log(err, rows);
// callback(err, rows);
// });
};
exports
.
grade
=
function
(
student
,
roomID
,
callback
)
{
let
query
=
"
SELECT * FROM flatStats WHERE roomID = ? AND userID = ?
"
;
let
params
=
[
roomID
,
student
.
id
];
bdd
.
query
(
query
,
params
,
(
err
,
submList
)
=>
{
let
tot
=
0
;
submList
.
forEach
((
subm
)
=>
{
if
(
tot
!=
"
unknown
"
&&
subm
.
correct
!=
"
unknown
"
)
{
tot
+=
parseFloat
(
subm
.
correct
);
}
else
tot
=
"
unknown
"
;
});
if
(
tot
!=
"
unknown
"
)
callback
(
err
,
(
tot
)
/
(
submList
.
length
==
0
?
1
:
submList
.
length
));
else
callback
(
err
,
tot
);
});
};
function
tryGetSubmission
(
userID
,
roomID
,
questionID
,
callback
)
{
...
...
public/javascripts/cc_admin.js
View file @
8ca38315
...
...
@@ -112,115 +112,99 @@ function afficheResponse (reponse) {
if
(
document
.
querySelector
(
"
li#q-
"
+
reponse
.
id
))
document
.
querySelector
(
"
li#q-
"
+
reponse
.
id
).
classList
.
add
(
"
currentQuestion
"
);
let
notTheSame
=
typeof
currentQuestionOfCC
==
"
undefined
"
;
notTheSame
=
notTheSame
||
!
document
.
querySelector
(
"
#question
"
);
notTheSame
=
notTheSame
||
document
.
querySelector
(
"
#question
"
).
textContent
!=
reponse
.
enonce
;
// On stocke la question
// currentQuestionOfCC = reponse;
// On écrit l'énoncé là où il faut. MathJax rendered.
let
enonce
=
document
.
querySelector
(
"
#question
"
);
enonce
.
textContent
=
reponse
.
enonce
;
MathJax
.
Hub
.
Queue
([
"
Typeset
"
,
MathJax
.
Hub
,
enonce
]);
// On nettoie les réponses précédentes
let
wrapper
=
document
.
querySelector
(
"
#wrapperAnswer
"
);
while
(
wrapper
.
firstChild
)
{
wrapper
.
removeChild
(
wrapper
.
firstChild
);
}
// Si besoin est, on rajoute la description
let
descr
=
document
.
querySelector
(
"
#description
"
);
if
(
reponse
.
description
)
descr
.
style
.
visibility
=
"
visible
"
;
else
descr
.
style
.
visibility
=
"
hidden
"
;
if
(
reponse
.
description
)
descr
.
innerHTML
=
md
.
render
(
reponse
.
description
);
else
descr
.
textContent
=
reponse
.
description
;
MathJax
.
Hub
.
Queue
([
"
Typeset
"
,
MathJax
.
Hub
,
descr
]);
// Pour chaque nouvelle réponse :
reponse
.
allResponses
.
forEach
(
function
(
rep
,
index
)
{
// Création de l'élément HTML vide
if
(
notTheSame
)
{
console
.
log
(
"
we change the question
"
);
// On écrit l'énoncé là où il faut. MathJax rendered.
let
enonce
=
document
.
querySelector
(
"
#question
"
);
enonce
.
textContent
=
reponse
.
enonce
;
MathJax
.
Hub
.
Queue
([
"
Typeset
"
,
MathJax
.
Hub
,
enonce
]);
// On nettoie les réponses précédentes
let
wrapper
=
document
.
querySelector
(
"
#wrapperAnswer
"
);
while
(
wrapper
.
firstChild
)
{
wrapper
.
removeChild
(
wrapper
.
firstChild
);
}
// Si besoin est, on rajoute la description
let
descr
=
document
.
querySelector
(
"
#description
"
);
if
(
reponse
.
description
)
descr
.
style
.
visibility
=
"
visible
"
;
else
descr
.
style
.
visibility
=
"
hidden
"
;
if
(
reponse
.
description
)
descr
.
innerHTML
=
md
.
render
(
reponse
.
description
);
else
descr
.
textContent
=
reponse
.
description
;
MathJax
.
Hub
.
Queue
([
"
Typeset
"
,
MathJax
.
Hub
,
descr
]);
// Pour chaque nouvelle réponse :
reponse
.
allResponses
.
forEach
(
function
(
rep
,
index
)
{
// Création de l'élément HTML vide
let
elem
=
document
.
createElement
(
'
div
'
);
elem
.
classList
.
add
(
"
reponse
"
);
elem
.
classList
.
add
(
"
notSelected
"
);
if
(
rep
.
validity
)
elem
.
classList
.
add
(
rep
.
validity
);
elem
.
id
=
"
r
"
+
index
;
// Création de l'élément contenant l'énoncé de la réponse
let
span
=
document
.
createElement
(
"
span
"
);
elem
.
innerHTML
=
""
;
span
.
innerHTML
=
md
.
render
(
rep
.
reponse
);
console
.
log
(
span
,
rep
.
reponse
);
span
.
classList
.
add
(
"
markdown
"
);
elem
.
appendChild
(
span
);
// Si besoin, ajout d'un textarea
if
(
rep
.
texted
)
{
let
textarea
=
document
.
createElement
(
"
div
"
);
textarea
.
style
.
width
=
"
100%
"
;
textarea
.
style
.
display
=
"
block
"
;
textarea
.
style
.
color
=
"
green
"
;
textarea
.
style
.
fontSize
=
"
medium
"
;
if
(
rep
.
correction
)
textarea
.
textContent
=
"
Correction :
"
+
rep
.
correction
;
// Ajout d'un event listener pour le textarea
/* if(typeof isAdmin == "undefined") {
textarea.addEventListener("input", (ev) => {
console.log("updateed");
chooseAnswer(index, elem, true); //updateAnswer(index, elem, true);
// sendAnswer();
});
}*/
elem
.
appendChild
(
textarea
);
}
MathJax
.
Hub
.
Queue
([
"
Typeset
"
,
MathJax
.
Hub
,
elem
]);
let
button
=
document
.
createElement
(
"
button
"
);
button
.
addEventListener
(
"
click
"
,(
ev
)
=>
{
setValidity
(
index
,
"
true
"
);
});
let
button2
=
document
.
createElement
(
"
button
"
);
button2
.
addEventListener
(
"
click
"
,(
ev
)
=>
{
setValidity
(
index
,
"
false
"
);
});
button
.
textContent
=
"
Forcer à juste
"
;
button2
.
textContent
=
"
Forcer à faux
"
;
elem
.
appendChild
(
button
);
elem
.
appendChild
(
button2
);
wrapper
.
appendChild
(
elem
);
});
let
elem
=
document
.
createElement
(
'
div
'
);
elem
.
classList
.
add
(
"
reponse
"
);
elem
.
classList
.
add
(
"
notSelected
"
);
if
(
rep
.
validity
)
elem
.
classList
.
add
(
rep
.
validity
);
elem
.
id
=
"
r
"
+
index
;
// Création de l'élément contenant l'énoncé de la réponse
let
span
=
document
.
createElement
(
"
span
"
);
elem
.
innerHTML
=
""
;
span
.
innerHTML
=
md
.
render
(
rep
.
reponse
);
console
.
log
(
span
,
rep
.
reponse
);
span
.
classList
.
add
(
"
markdown
"
);
elem
.
appendChild
(
span
);
// Si besoin, ajout d'un textarea
if
(
rep
.
texted
)
{
let
textarea
=
document
.
createElement
(
"
div
"
);
textarea
.
style
.
width
=
"
100%
"
;
textarea
.
style
.
display
=
"
block
"
;
textarea
.
style
.
color
=
"
green
"
;
textarea
.
style
.
fontSize
=
"
medium
"
;
if
(
rep
.
correction
)
textarea
.
textContent
=
"
Correction :
"
+
rep
.
correction
;
// Ajout d'un event listener pour le textarea
/* if(typeof isAdmin == "undefined") {
textarea.addEventListener("input", (ev) => {
console.log("updateed");
chooseAnswer(index, elem, true); //updateAnswer(index, elem, true);
// sendAnswer();
});
}*/
elem
.
appendChild
(
textarea
);
}
MathJax
.
Hub
.
Queue
([
"
Typeset
"
,
MathJax
.
Hub
,
elem
]);
let
button
=
document
.
createElement
(
"
button
"
);
button
.
addEventListener
(
"
click
"
,(
ev
)
=>
{
setValidity
(
index
,
"
true
"
);
});
let
button2
=
document
.
createElement
(
"
button
"
);
button2
.
addEventListener
(
"
click
"
,(
ev
)
=>
{
setValidity
(
index
,
"
false
"
);
});
button
.
textContent
=
"
Forcer à juste
"
;
button2
.
textContent
=
"
Forcer à faux
"
;
elem
.
appendChild
(
button
);
elem
.
appendChild
(
button2
);
wrapper
.
appendChild
(
elem
);
});
let
elem
=
document
.
createElement
(
'
div
'
);
elem
.
classList
.
add
(
"
reponse
"
);
elem
.
classList
.
add
(
"
notSelected
"
);
elem
.
innerHTML
=
"
Stratégie de correction : <select id='strategy'>
"
+
"
<option value='all_or_0'
"
+
(
"
all_or_0
"
==
reponse
.
strategy
?
"
selected>
"
:
"
>
"
)
+
"
all_or_0</option>
"
+
"
<option value='QCM'
"
+
(
"
QCM
"
==
reponse
.
strategy
?
"
selected>
"
:
"
>
"
)
+
"
QCM</option>
"
+
"
<option value='manual'
"
+
(
"
manual
"
==
reponse
.
strategy
?
"
selected>
"
:
"
>
"
)
+
"
manual</option>
"
+
"
</select>
"
;
if
(
reponse
.
strategy
==
"
manual
"
)
{
// elem.innerHTML += "<input type='number' id='mark' min='-1' max='1' step='0.05'>";
let
mark
=
document
.
createElement
(
"
input
"
);
mark
.
id
=
"
mark
"
;
mark
.
type
=
"
number
"
;
mark
.
min
=
"
-1
"
;
mark
.
max
=
"
1
"
;
mark
.
value
=
"
1
"
;
mark
.
step
=
"
0.05
"
;
elem
.
appendChild
(
mark
);
}
elem
.
innerHTML
+=
"
Note finale : <span id='note'>
"
+
"
N/A
"
+
"
</span>
"
;
let
mark
=
elem
.
querySelector
(
"
#mark
"
);
if
(
mark
)
{
mark
.
addEventListener
(
"
change
"
,
(
ev
)
=>
{
setStrategy
();});
mark
.
value
=
reponse
.
mark
;
}
let
select
=
elem
.
querySelector
(
"
select
"
);
// console.log("we add event listener for ", select);
select
.
addEventListener
(
"
change
"
,
(
ev
)
=>
{
// console.log(ev, "updated");
let
mark
=
document
.
querySelector
(
"
#mark
"
);
if
(
select
.
value
==
"
manual
"
&&
!
mark
)
{
elem
.
innerHTML
=
"
Stratégie de correction : <select id='strategy'>
"
+
"
<option value='all_or_0'
"
+
(
"
all_or_0
"
==
reponse
.
strategy
?
"
selected>
"
:
"
>
"
)
+
"
all_or_0</option>
"
+
"
<option value='QCM'
"
+
(
"
QCM
"
==
reponse
.
strategy
?
"
selected>
"
:
"
>
"
)
+
"
QCM</option>
"
+
"
<option value='manual'
"
+
(
"
manual
"
==
reponse
.
strategy
?
"
selected>
"
:
"
>
"
)
+
"
manual</option>
"
+
"
</select>
"
;
if
(
reponse
.
strategy
==
"
manual
"
)
{
// elem.innerHTML += "<input type='number' id='mark' min='-1' max='1' step='0.05'>";
let
mark
=
document
.
createElement
(
"
input
"
);
mark
.
id
=
"
mark
"
;
mark
.
type
=
"
number
"
;
...
...
@@ -228,16 +212,44 @@ function afficheResponse (reponse) {
mark
.
max
=
"
1
"
;
mark
.
value
=
"
1
"
;
mark
.
step
=
"
0.05
"
;
mark
.
value
=
1
;
mark
.
addEventListener
(
"
change
"
,
(
ev
)
=>
{
setStrategy
();});
select
.
parentNode
.
insertBefore
(
mark
,
ev
.
target
.
nextSibling
);
elem
.
appendChild
(
mark
);
}
elem
.
innerHTML
+=
"
Note finale : <span id='note'>
"
+
"
N/A
"
+
"
</span>
"
;
let
mark
=
elem
.
querySelector
(
"
#mark
"
);
if
(
mark
)
{
mark
.
addEventListener
(
"
input
"
,
(
ev
)
=>
{
console
.
log
(
"
change
"
);
setStrategy
();});
mark
.
value
=
reponse
.
mark
;
}
else
if
(
mark
)
{
mark
.
parentNode
.
removeChild
(
mark
);
let
select
=
elem
.
querySelector
(
"
select
"
);
// console.log("we add event listener for ", select);
select
.
addEventListener
(
"
change
"
,
(
ev
)
=>
{
// console.log(ev, "updated");
let
mark
=
document
.
querySelector
(
"
#mark
"
);
if
(
select
.
value
==
"
manual
"
&&
!
mark
)
{
let
mark
=
document
.
createElement
(
"
input
"
);
mark
.
id
=
"
mark
"
;
mark
.
type
=
"
number
"
;
mark
.
min
=
"
-1
"
;
mark
.
max
=
"
1
"
;
mark
.
value
=
"
1
"
;
mark
.
step
=
"
0.05
"
;
// mark.value = 1;
mark
.
addEventListener
(
"
change
"
,
(
ev
)
=>
{
setStrategy
();});
select
.
parentNode
.
insertBefore
(
mark
,
ev
.
target
.
nextSibling
);
}
else
if
(
mark
)
{
mark
.
parentNode
.
removeChild
(
mark
);
}
setStrategy
();
});
wrapper
.
appendChild
(
elem
);
}
reponse
.
allResponses
.
forEach
(
function
(
rep
,
index
)
{
if
(
rep
.
validity
)
{
document
.
querySelector
(
"
#r
"
+
index
).
classList
.
remove
(
"
to_correct
"
,
"
true
"
,
"
false
"
);
document
.
querySelector
(
"
#r
"
+
index
).
classList
.
add
(
rep
.
validity
);
}
setStrategy
();
});
wrapper
.
appendChild
(
elem
);
};
/*********************************************************************/
...
...
@@ -273,7 +285,8 @@ socketCC.on('newList', function (questionList) {
// console.log("sdfggfeer");
// gotoQuestion(question.indexSet);
currentQuestionOfCC
=
currentList
[
index
];
sendSubmission
();
socketCC
.
emit
(
"
sendStudentList
"
,
roomID
);
// sendSubmission();
});
// li.class = ""+(question.id == currentQuestionOfCC.id);
li
.
textContent
=
question
.
enonce
;
...
...
@@ -297,7 +310,7 @@ socketCC.on('newList', function (questionList) {
});
/*********************************************************************/
/* pour afficher une
quest
ion
*/
/* pour afficher une
submiss
ion */
/*********************************************************************/
function
affSubmission
(
submission
)
{
...
...
@@ -306,7 +319,11 @@ function affSubmission(submission) {
let
repElem
=
document
.
querySelector
(
"
#r
"
+
rep
.
n
);
repElem
.
classList
.
replace
(
"
notSelected
"
,
"
selected
"
);
if
(
submission
.
customQuestion
.
allResponses
[
rep
.
n
].
texted
)
{
let
textarea
=
document
.
createElement
(
"
textarea
"
);
let
textarea
if
(
repElem
.
querySelector
(
"
textarea
"
))
textarea
=
repElem
.
querySelector
(
"
textarea
"
);
else
textarea
=
document
.
createElement
(
"
textarea
"
);
textarea
.
style
.
width
=
"
100%
"
;
textarea
.
readOnly
=
true
;
textarea
.
style
.
display
=
"
block
"
;
...
...
@@ -331,7 +348,7 @@ socketCC.on('newSubmission', function (submission) {
});
/*********************************************************************/
/* Lors de la reception d'une
soumission
*/
/* Lors de la reception d'une
userList
*/
/*********************************************************************/
socketCC
.
on
(
'
newUserList
'
,
function
(
studentList
)
{
...
...
@@ -354,8 +371,9 @@ socketCC.on('newUserList', function (studentList) {
}
if
(
document
.
querySelector
(
"
li#s-
"
+
currentStudent
.
id
))
document
.
querySelector
(
"
li#s-
"
+
currentStudent
.
id
).
classList
.
add
(
"
currentQuestion
"
);
socketCC
.
emit
(
"
sendList
"
,
roomID
,
currentStudent
.
userID
);
sendSubmission
();
// socketCC.emit("sendList", roomID, currentStudent.userID);
socketCC
.
emit
(
"
sendStudentList
"
,
roomID
);
// sendSubmission();
};
MathJax
.
Hub
.
Queue
([
"
Typeset
"
,
MathJax
.
Hub
,
li
]);
ul
.
appendChild
(
li
);
...
...
@@ -364,8 +382,8 @@ socketCC.on('newUserList', function (studentList) {
old
.
parentNode
.
replaceChild
(
ul
,
old
);
// Dans tous les cas, on refait le check des petites marques blanches
document
.
querySelectorAll
(
"
.s-
"
).
forEach
((
elem
,
index
)
=>
{
//
if(studentList[index].
questionID
)
//
elem.
classList.add("answered")
;
if
(
studentList
[
index
].
grade
!=
"
unknown
"
)
elem
.
textContent
+=
"
:
"
+
(
Math
.
round
(
studentList
[
index
].
grade
*
20
*
4
)
/
4
)
+
"
/20
"
;
// else
// elem.classList.remove("answered");
});
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment