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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
47 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 = {
...
@@ -859,12 +859,13 @@ module.exports = {
.
then
(
student
=>
{
.
then
(
student
=>
{
student
.
id_active_scene
=
params
.
id_scene
;
student
.
id_active_scene
=
params
.
id_scene
;
delete
student
.
password
;
delete
student
.
password
;
delete
student
.
username
;
student
.
save
(
function
(
error
){
student
.
save
(
function
(
error
){
if
(
error
){
if
(
error
){
return
res
.
serverError
(
"Error updating active scene"
);
return
res
.
serverError
(
"Error updating active scene"
);
}
}
else
{
else
{
return
res
.
ok
();
return
res
.
ok
(
student
);
}
}
})
})
}).
catch
(
function
(
err
){
}).
catch
(
function
(
err
){
...
...
sails/src/assets/scripts/modules/student/controllers/collections.js
View file @
a0493780
...
@@ -297,13 +297,11 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
...
@@ -297,13 +297,11 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
$scope
.
activate_scene
=
function
(
scene
)
{
$scope
.
activate_scene
=
function
(
scene
)
{
$http
.
put
(
config
.
backend
+
'/stu/'
+
$scope
.
studentData
.
id
+
'/activeScene/'
+
scene
.
id
,
{
id_scene
:
scene
.
id
})
$http
.
put
(
config
.
backend
+
'/stu/'
+
$scope
.
studentData
.
id
+
'/activeScene/'
+
scene
.
id
,
{
id_scene
:
scene
.
id
})
.
success
(
function
()
{
.
success
(
function
(
stu
)
{
var
data
=
{
id
:
scene
.
id
};
io
.
socket
.
post
(
'/s
cene
'
,
{
io
.
socket
.
post
(
'/s
tu/config
'
,
{
action
:
'
activ
ate'
,
action
:
'
upd
ate'
,
scene
:
data
attributes
:
stu
},
function
()
{});
},
function
()
{});
$translate
(
'scene_updated'
).
then
(
function
(
translation
)
{
$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
...
@@ -55,7 +55,6 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
.
get
(
config
.
backend
+
'/stu/'
+
$scope
.
studentData
.
id
+
'/tries'
)
.
get
(
config
.
backend
+
'/stu/'
+
$scope
.
studentData
.
id
+
'/tries'
)
.
success
(
function
(
data
)
{
.
success
(
function
(
data
)
{
$scope
.
fulldata
=
data
;
$scope
.
fulldata
=
data
;
for
(
var
i
=
0
;
i
<
$scope
.
fulldata
.
methods
.
length
;
i
++
){
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
});
$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
++
){
for
(
var
j
=
0
;
j
<
$scope
.
fulldata
.
methods
[
i
].
instructions
.
length
;
j
++
){
...
@@ -330,7 +329,6 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
...
@@ -330,7 +329,6 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
$scope
.
dataChart6
=
$scope
.
phrase_average_time
;
$scope
.
dataChart6
=
$scope
.
phrase_average_time
;
};
};
/***
/***
* Instruction selected
* Instruction selected
* method_pos is the position of the method in $scope.statistic_methods
* method_pos is the position of the method in $scope.statistic_methods
...
@@ -358,36 +356,8 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
...
@@ -358,36 +356,8 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
var
average_time_pictos_ws
=
0
;
var
average_time_pictos_ws
=
0
;
var
phrase_average_size
=
0
;
var
phrase_average_size
=
0
;
var
phrase_average_build_time
=
0
;
var
phrase_average_build_time
=
0
;
for
(
var
j
=
0
;
j
<
working_sessions
[
i
].
tries
.
length
;
j
++
){
switch
(
working_sessions
[
i
].
tries
[
j
].
result
)
{
var
calc
=
function
(){
case
"SUCCESS"
:
$scope
.
tries_count
[
"success"
]
++
;
success
++
;
break
;
case
"SUPERVISED SUCCESS"
:
$scope
.
tries_count
[
"supervised_success"
]
++
;
break
;
case
"SPONTANEOUS SUCCESS"
:
$scope
.
tries_count
[
"spontaneous_success"
]
++
;
break
;
case
"FAIL"
:
$scope
.
tries_count
[
"fail"
]
++
;
break
;
case
"DISCARDED"
:
$scope
.
tries_count
[
"discarded"
]
++
;
break
;
case
"MODEL"
:
$scope
.
tries_count
[
"model"
]
++
;
break
;
case
"BROKEN"
:
$scope
.
tries_count
[
"broken"
]
++
;
break
;
case
null
:
$scope
.
tries_count
[
"null"
]
++
;
break
;
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
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
();
var
d
=
moment
.
duration
(
ms
).
asMilliseconds
();
tries_average_time
+=
d
;
tries_average_time
+=
d
;
...
@@ -398,7 +368,8 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
...
@@ -398,7 +368,8 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
//La primera accion es initsession
//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"
);
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
++
){
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"
){
if
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
type
==
"pausesession"
){
//Saltar esta action. La siguiente action a pausesession será before
//Saltar esta action. La siguiente action a pausesession será before
if
(
k
+
1
<
working_sessions
[
i
].
tries
[
j
].
actions
.
length
){
if
(
k
+
1
<
working_sessions
[
i
].
tries
[
j
].
actions
.
length
){
...
@@ -410,14 +381,13 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
...
@@ -410,14 +381,13 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
}
}
}
else
{
}
else
{
var
now
=
moment
(
new
Date
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
timestamp
),
"DD/MM/YYYY HH:mm:ss.SSS"
);
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
dif
=
moment
(
now
).
diff
(
before
);
var
miliseconds
=
moment
.
duration
(
dif
).
asMilliseconds
();
var
miliseconds
=
moment
.
duration
(
dif
).
asMilliseconds
();
console
.
log
(
"dif miliseconds="
+
miliseconds
);
average_time_pictos_action
+=
miliseconds
;
average_time_pictos_action
+=
miliseconds
;
before
=
now
;
before
=
now
;
if
(
working_sessions
[
i
].
tries
[
j
].
result
==
"SUCCESS"
){
var
count_pictos
=
0
;
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"
){
if
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
type
==
"Delete"
){
//The user deleted the last action
//The user deleted the last action
...
@@ -430,7 +400,8 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
...
@@ -430,7 +400,8 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
$scope
.
vocab_size_aux
.
push
(
working_sessions
[
i
].
tries
[
j
].
actions
[
k
].
description
.
picto
.
id
);
$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"
){
}
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"
);
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
);
dif
=
moment
(
phrase_end
).
diff
(
phrase_start
);
miliseconds
=
moment
.
duration
(
dif
).
asMilliseconds
();
miliseconds
=
moment
.
duration
(
dif
).
asMilliseconds
();
phrase_average_build_time
+=
miliseconds
;
phrase_average_build_time
+=
miliseconds
;
...
@@ -438,14 +409,50 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
...
@@ -438,14 +409,50 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
phrase_average_size
+=
count_pictos
;
phrase_average_size
+=
count_pictos
;
}
}
}
}
}
average_time_pictos_ws
+=
average_time_pictos_action
/
working_sessions
[
i
].
tries
[
j
].
actions
.
length
;
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"
]
++
;
break
;
case
"SPONTANEOUS SUCCESS"
:
$scope
.
tries_count
[
"spontaneous_success"
]
++
;
break
;
case
"FAIL"
:
$scope
.
tries_count
[
"fail"
]
++
;
break
;
case
"DISCARDED"
:
$scope
.
tries_count
[
"discarded"
]
++
;
break
;
case
"MODEL"
:
$scope
.
tries_count
[
"model"
]
++
;
break
;
case
"BROKEN"
:
$scope
.
tries_count
[
"broken"
]
++
;
break
;
case
null
:
$scope
.
tries_count
[
"null"
]
++
;
break
;
default
:
$scope
.
tries_count
[
"null"
]
++
;
}
}
}
$scope
.
tries_count
[
"total"
]
+=
working_sessions
[
i
].
tries
.
length
;
$scope
.
tries_count
[
"total"
]
+=
working_sessions
[
i
].
tries
.
length
;
error_rate
=
success
/
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
tries_average_time
=
tries_average_time
/
success
;
//average time per trie per ws
average_time_pictos_ws
=
average_time_pictos_ws
/
working_sessions
[
i
].
tries
.
length
;
average_time_pictos_ws
=
average_time_pictos_ws
/
success
;
phrase_average_build_time
=
phrase_average_build_time
/
success
;
//milliseconds
phrase_average_build_time
=
phrase_average_build_time
/
success
;
//milliseconds
phrase_average_size
=
phrase_average_size
/
success
;
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