Commit cfe6bf02 by Иван Кубота

yep

parent d1eab614
......@@ -119,9 +119,10 @@ console.log('WS LISTEN port: '+env.WS_PORT);
var logging = [];
global.log = function(type, data){
global.log = function(type, data, date){
try{
logging.push({date:+new Date(), type, data});
var d = date ? +new Date(date): +new Date();
logging.push({date:d, type, data});
wss.clients.forEach(function each(client) {
client.send(JSON.stringify({type, data}));
});
......
......@@ -100,11 +100,12 @@
connected: function(data){
D.div({cls: 'msg', renderTo: log}, D.span({cls: 'msg-bold'}, 'Connected'));
},
answerQuiz: function(data){
answerQuiz: function(data, date){
if( questionsHashGlobal[data.question.id]) {
questionsHashGlobal[data.question.id].el.className = 'question ' + (data.question.correct ? 'correct' : 'incorrect')
questionsHashGlobal[data.question.id].el.setAttribute('alt', new Date(data.date));
questionsHashGlobal[data.question.id].el.setAttribute('title', new Date(data.date));
questionsHashGlobal[data.question.id].el.setAttribute('alt', new Date(date));
questionsHashGlobal[data.question.id].el.setAttribute('title', new Date(date));
}
/*
D.div({cls: 'msg', renderTo: log}, D.span({cls: 'msg-bold'}, data.user.name.join(' ')), 'начал тест из',
......@@ -153,7 +154,7 @@ var f;
debugger;
data;
data.forEach(data=>{
actions[data.type](data.data);
actions[data.type](data.data, data.date);
begin = data.date;
})
} );
......
......@@ -256,7 +256,9 @@ module.exports = {
name: [u.lastname, u.firstname, u.middlename]
},
attempt: attemptID,
question: qS
question: qS.map(q=>({
id: q.id,
}))
});
} catch (e) {
console.error(e);
......@@ -416,3 +418,18 @@ module.exports = {
}
},
};
/*
setTimeout(async ()=>{
await asyncPool('SELECT * from quiz_attempt where create')
log('createQuiz', {
user: {
id: args.body.user_id,
name: [u.lastname, u.firstname, u.middlename]
},
attempt: attemptID,
question: qS.map(q=>({
id: q.id,
}))
});
},4000)*/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment