Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a0493780
authored
May 16, 2017
by
Sebastián Collado Montañez
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'develop' of
http://gitlab.ujaen.es/yotta/pictogram
into develop
parents
bcce0e4b
76697202
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
64 deletions
sails/src/api/controllers/StudentController.js
sails/src/assets/scripts/modules/student/controllers/collections.js
sails/src/assets/scripts/modules/student/controllers/reports.js
sails/src/api/controllers/StudentController.js
View file @
a0493780
...
...
@@ -859,12 +859,13 @@ module.exports = {
.
then
(
student
=>
{
student
.
id_active_scene
=
params
.
id_scene
;
delete
student
.
password
;
delete
student
.
username
;
student
.
save
(
function
(
error
){
if
(
error
){
return
res
.
serverError
(
"Error updating active scene"
);
}
else
{
return
res
.
ok
();
return
res
.
ok
(
student
);
}
})
}).
catch
(
function
(
err
){
...
...
sails/src/assets/scripts/modules/student/controllers/collections.js
View file @
a0493780
...
...
@@ -297,13 +297,11 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
$scope
.
activate_scene
=
function
(
scene
)
{
$http
.
put
(
config
.
backend
+
'/stu/'
+
$scope
.
studentData
.
id
+
'/activeScene/'
+
scene
.
id
,
{
id_scene
:
scene
.
id
})
.
success
(
function
()
{
var
data
=
{
id
:
scene
.
id
};
.
success
(
function
(
stu
)
{
io
.
socket
.
post
(
'/s
cene
'
,
{
action
:
'
activ
ate'
,
scene
:
data
io
.
socket
.
post
(
'/s
tu/config
'
,
{
action
:
'
upd
ate'
,
attributes
:
stu
},
function
()
{});
$translate
(
'scene_updated'
).
then
(
function
(
translation
)
{
...
...
sails/src/assets/scripts/modules/student/controllers/reports.js
View file @
a0493780
...
...
@@ -55,7 +55,6 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
.
get
(
config
.
backend
+
'/stu/'
+
$scope
.
studentData
.
id
+
'/tries'
)
.
success
(
function
(
data
)
{
$scope
.
fulldata
=
data
;
for
(
var
i
=
0
;
i
<
$scope
.
fulldata
.
methods
.
length
;
i
++
){
$scope
.
elems
.
push
({
id
:
$scope
.
fulldata
.
methods
[
i
].
id
,
class
:
"method-opt"
,
name
:
$scope
.
fulldata
.
methods
[
i
].
name
});
for
(
var
j
=
0
;
j
<
$scope
.
fulldata
.
methods
[
i
].
instructions
.
length
;
j
++
){
...
...
@@ -330,7 +329,6 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
$scope
.
dataChart6
=
$scope
.
phrase_average_time
;
};
/***
* Instruction selected
* method_pos is the position of the method in $scope.statistic_methods
...
...
@@ -358,11 +356,71 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
var
average_time_pictos_ws
=
0
;
var
phrase_average_size
=
0
;
var
phrase_average_build_time
=
0
;
var
calc
=
function
(){
var
ms
=
moment
(
new
Date
(
working_sessions
[
i
].
tries
[
j
].
end
),
"DD/MM/YYYY HH:mm:ss.SSS"
).
diff
(
moment
(
new
Date
(
working_sessions
[
i
].
tries
[
j
].
begin
)
,
"DD/MM/YYYY HH:mm:ss.SSS"
));
var
d
=
moment
.
duration
(
ms
).
asMilliseconds
();
tries_average_time
+=
d
;
if
(
working_sessions
[
i
].
tries
[
j
].
actions
.
length
>
0
){
var
average_time_pictos_action
=
0
;
//La primera accion es initsession
var
before
=
moment
(
new
Date
(
working_sessions
[
i
].
tries
[
j
].
actions
[
0
].
timestamp
),
"DD/MM/YYYY HH:mm:ss.SSS"
);
for
(
var
k
=
1
;
k
<
working_sessions
[
i
].
tries
[
j
].
actions
.
length
;
k
++
){
console
.
log
(
"action="
+
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
type
);
console
.
log
(
"Before="
+
before
+
" timestamp="
+
working_sessions
[
i
].
tries
[
j
].
actions
[
0
].
timestamp
);
if
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
type
==
"pausesession"
){
//Saltar esta action. La siguiente action a pausesession será before
if
(
k
+
1
<
working_sessions
[
i
].
tries
[
j
].
actions
.
length
){
//Comprobacion para evitar salir del array
before
=
moment
(
new
Date
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
+
1
].
timestamp
),
"DD/MM/YYYY HH:mm:ss.SSS"
);
}
else
{
//Esta condicion nunca se va a dar puesto que si el tamaño de acciones
//es menor que K es porque esta es la ultima acción, no hay una accion tipo SHOW al final del try
}
}
else
{
var
now
=
moment
(
new
Date
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
timestamp
),
"DD/MM/YYYY HH:mm:ss.SSS"
);
console
.
log
(
"Now="
+
now
+
" timestamp="
+
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
timestamp
);
var
dif
=
moment
(
now
).
diff
(
before
);
var
miliseconds
=
moment
.
duration
(
dif
).
asMilliseconds
();
console
.
log
(
"dif miliseconds="
+
miliseconds
);
average_time_pictos_action
+=
miliseconds
;
before
=
now
;
var
count_pictos
=
0
;
if
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
type
==
"Delete"
){
//The user deleted the last action
$scope
.
vocab_size_aux
.
pop
();
count_pictos
--
;
}
else
if
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
type
==
"Add"
){
count_pictos
++
;
if
(
$scope
.
vocab_size_aux
.
indexOf
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
description
.
picto
.
id
)
==
-
1
){
//Si el id del picto no se encuentra en el array se añade
$scope
.
vocab_size_aux
.
push
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
description
.
picto
.
id
);
}
}
else
if
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
type
==
"Show"
){
var
phrase_start
=
moment
(
working_sessions
[
i
].
tries
[
j
].
begin
,
"DD/MM/YYYY HH:mm:ss.SSS"
);
var
phrase_end
=
moment
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
timestamp
,
"DD/MM/YYYY HH:mm:ss.SSS"
);
dif
=
moment
(
phrase_end
).
diff
(
phrase_start
);
miliseconds
=
moment
.
duration
(
dif
).
asMilliseconds
();
phrase_average_build_time
+=
miliseconds
;
}
phrase_average_size
+=
count_pictos
;
}
}
average_time_pictos_ws
+=
average_time_pictos_action
/
working_sessions
[
i
].
tries
[
j
].
actions
.
length
;
console
.
log
(
"average_time_pictos_action="
+
average_time_pictos_action
);
console
.
log
(
"average_time_pictos_ws="
+
average_time_pictos_ws
);
}
};
for
(
var
j
=
0
;
j
<
working_sessions
[
i
].
tries
.
length
;
j
++
){
switch
(
working_sessions
[
i
].
tries
[
j
].
result
)
{
case
"SUCCESS"
:
$scope
.
tries_count
[
"success"
]
++
;
success
++
;
calc
();
break
;
case
"SUPERVISED SUCCESS"
:
$scope
.
tries_count
[
"supervised_success"
]
++
;
...
...
@@ -388,64 +446,13 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
default
:
$scope
.
tries_count
[
"null"
]
++
;
}
var
ms
=
moment
(
new
Date
(
working_sessions
[
i
].
tries
[
j
].
end
),
"DD/MM/YYYY HH:mm:ss.SSS"
).
diff
(
moment
(
new
Date
(
working_sessions
[
i
].
tries
[
j
].
begin
)
,
"DD/MM/YYYY HH:mm:ss.SSS"
));
var
d
=
moment
.
duration
(
ms
).
asMilliseconds
();
tries_average_time
+=
d
;
if
(
working_sessions
[
i
].
tries
[
j
].
actions
.
length
>
0
){
var
average_time_pictos_action
=
0
;
//La primera accion es initsession
var
before
=
moment
(
new
Date
(
working_sessions
[
i
].
tries
[
j
].
actions
[
0
].
timestamp
),
"DD/MM/YYYY HH:mm:ss.SSS"
);
for
(
var
k
=
1
;
k
<
working_sessions
[
i
].
tries
[
j
].
actions
.
length
;
k
++
){
if
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
type
==
"pausesession"
){
//Saltar esta action. La siguiente action a pausesession será before
if
(
k
+
1
<
working_sessions
[
i
].
tries
[
j
].
actions
.
length
){
//Comprobacion para evitar salir del array
before
=
moment
(
new
Date
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
+
1
].
timestamp
),
"DD/MM/YYYY HH:mm:ss.SSS"
);
}
else
{
//Esta condicion nunca se va a dar puesto que si el tamaño de acciones
//es menor que K es porque esta es la ultima acción, no hay una accion tipo SHOW al final del try
}
}
else
{
var
now
=
moment
(
new
Date
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
timestamp
),
"DD/MM/YYYY HH:mm:ss.SSS"
);
var
dif
=
moment
(
now
).
diff
(
before
);
var
miliseconds
=
moment
.
duration
(
dif
).
asMilliseconds
();
average_time_pictos_action
+=
miliseconds
;
before
=
now
;
if
(
working_sessions
[
i
].
tries
[
j
].
result
==
"SUCCESS"
){
var
count_pictos
=
0
;
var
phrase_start
=
moment
(
working_sessions
[
i
].
tries
[
j
].
begin
,
"DD/MM/YYYY HH:mm:ss.SSS"
);
var
phrase_end
=
0
;
if
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
type
==
"Delete"
){
//The user deleted the last action
$scope
.
vocab_size_aux
.
pop
();
count_pictos
--
;
}
else
if
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
type
==
"Add"
){
count_pictos
++
;
if
(
$scope
.
vocab_size_aux
.
indexOf
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
description
.
picto
.
id
)
==
-
1
){
//Si el id del picto no se encuentra en el array se añade
$scope
.
vocab_size_aux
.
push
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
description
.
picto
.
id
);
}
}
else
if
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
type
==
"Show"
){
phrase_end
=
moment
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
timestamp
,
"DD/MM/YYYY HH:mm:ss.SSS"
);
dif
=
moment
(
phrase_end
).
diff
(
phrase_start
);
miliseconds
=
moment
.
duration
(
dif
).
asMilliseconds
();
phrase_average_build_time
+=
miliseconds
;
}
phrase_average_size
+=
count_pictos
;
}
}
}
average_time_pictos_ws
+=
average_time_pictos_action
/
working_sessions
[
i
].
tries
[
j
].
actions
.
length
;
}
}
$scope
.
tries_count
[
"total"
]
+=
working_sessions
[
i
].
tries
.
length
;
error_rate
=
success
/
working_sessions
[
i
].
tries
.
length
;
tries_average_time
=
tries_average_time
/
working_sessions
[
i
].
tries
.
length
;
//average time per trie per ws
average_time_pictos_ws
=
average_time_pictos_ws
/
working_sessions
[
i
].
tries
.
length
;
tries_average_time
=
tries_average_time
/
success
;
//average time per trie per ws
average_time_pictos_ws
=
average_time_pictos_ws
/
success
;
phrase_average_build_time
=
phrase_average_build_time
/
success
;
//milliseconds
phrase_average_size
=
phrase_average_size
/
success
;
...
...
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