Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kus-admin
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Кубота
kus-admin
Commits
cfe6bf02
Commit
cfe6bf02
authored
Jul 15, 2020
by
Иван Кубота
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
yep
parent
d1eab614
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
9 deletions
+27
-9
api.js
api.js
+3
-2
monitor.html
public/monitor.html
+5
-4
quiz.js
src/api/quiz.js
+19
-3
No files found.
api.js
View file @
cfe6bf02
...
...
@@ -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
}));
});
...
...
public/monitor.html
View file @
cfe6bf02
...
...
@@ -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
;
})
}
);
...
...
src/api/quiz.js
View file @
cfe6bf02
...
...
@@ -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
);
...
...
@@ -415,4 +417,19 @@ module.exports = {
return
out
;
}
},
};
\ No newline at end of file
};
/*
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)*/
Write
Preview
Markdown
is supported
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