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
83d61be6
authored
Mar 17, 2017
by
Jose Antonio
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
reports - show working sessions
parent
fc4e3268
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
77 deletions
sails/src/assets/scripts/modules/student/controllers/reports.js
sails/src/assets/scripts/modules/student/controllers/reports.js
View file @
83d61be6
...
...
@@ -117,14 +117,14 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"broken"
:
0
,
"null"
:
0
};
$scope
.
method_chart_dates
=
[];
// [2010-02....]
$scope
.
error_rate_rate
=
[
];
// [33.3, ...]
$scope
.
average_time_trie
=
[
];
// [3, 4,...] seconds
$scope
.
average_time_pictos
=
[];
$scope
.
vocab_size
=
[];
$scope
.
method_chart_dates
=
[[]];
$scope
.
error_rate_rate
=
[
[]];
$scope
.
average_time_trie
=
[
[]];
$scope
.
average_time_pictos
=
[
[]
];
$scope
.
vocab_size
=
[
[]
];
$scope
.
vocab_size_aux
=
[];
$scope
.
phrase_average_time
=
[
];
$scope
.
phrase_average_size
=
[];
$scope
.
phrase_average_time
=
[[]
];
$scope
.
phrase_average_size
=
[
[]
];
if
(
selected_method
.
class
===
"method-opt"
){
//check the selected method
...
...
@@ -139,29 +139,13 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
}
//There is a method selected
//Get the selected method/s instructions by date
$scope
.
method_chart_dates
=
[[]];
$scope
.
error_rate_rate
=
[[]];
$scope
.
average_time_trie
=
[[]];
$scope
.
average_time_pictos
=
[[]];
$scope
.
vocab_size
=
[[]];
$scope
.
phrase_average_time
=
[[]];
$scope
.
phrase_average_size
=
[[]];
for
(
var
i
=
0
;
i
<
$scope
.
statistic_methods
.
length
;
i
++
){
for
(
var
j
=
0
;
j
<
$scope
.
statistic_methods
[
i
].
instructions
.
length
;
j
++
){
if
(
new
Date
(
$scope
.
statistic_methods
[
i
].
instructions
[
j
].
begin
).
getTime
()
>
$scope
.
reportDateSince
.
getTime
()
&&
new
Date
(
$scope
.
statistic_methods
[
i
].
instructions
[
j
].
begin
).
getTime
()
<
$scope
.
reportDateTo
.
getTime
()){
//llamar a la funcion estadisticas con esta instruccion
var
statistics
=
statistics_instruction
(
j
,
i
);
$scope
.
error_rate_rate
[
0
].
push
(
statistics
[
7
]);
$scope
.
average_time_trie
[
0
].
push
(
statistics
[
8
]);
$scope
.
average_time_pictos
[
0
].
push
(
statistics
[
9
]);
$scope
.
vocab_size
[
0
].
push
(
statistics
[
10
]);
$scope
.
phrase_average_time
[
0
].
push
(
statistics
[
11
]);
$scope
.
phrase_average_size
[
0
].
push
(
statistics
[
12
]);
$scope
.
method_chart_dates
[
0
].
push
(
moment
(
$scope
.
statistic_methods
[
i
].
instructions
[
j
].
begin
).
format
(
"YYYY-MM-DD"
));
// $scope.error_rate_rate[0].push(statistics_instruction(j, i)[2].error_rate);
// $scope.error_rate_dates[0].push(moment($scope.statistic_methods[i].instructions[j].begin).format("YYYY-MM-DD"));
}
}
}
...
...
@@ -184,14 +168,6 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
if
(
new
Date
(
$scope
.
statistic_methods
[
0
].
instructions
[
j
].
begin
).
getTime
()
>
$scope
.
reportDateSince
.
getTime
()
&&
new
Date
(
$scope
.
statistic_methods
[
0
].
instructions
[
j
].
begin
).
getTime
()
<
$scope
.
reportDateTo
.
getTime
()){
var
statistics
=
statistics_instruction
(
j
,
0
);
$scope
.
error_rate_rate
.
push
(
statistics
[
1
]);
$scope
.
method_chart_dates
.
push
(
statistics
[
0
]);
$scope
.
average_time_trie
.
push
(
statistics
[
2
]);
$scope
.
average_time_pictos
.
push
(
statistics
[
3
]);
$scope
.
vocab_size
.
push
(
statistics
[
4
]);
$scope
.
phrase_average_time
.
push
(
statistics
[
5
]);
$scope
.
phrase_average_size
.
push
(
statistics
[
6
]);
}
}
}
...
...
@@ -359,24 +335,8 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
* Instruction selected
* method_pos is the position of the method in $scope.statistic_methods
* instruction_pos is the position of the instruction in $scope.statistic_methods
* return instruction_statistic [
[tries dates],
[tries error rate],
[tries average time],
[average_time_between_pictos_ws],
[vocab_size_ws],
[phrase_average_build_time],
[phrase_average_size],
[instruction error_rate],
[instruction tries average time],
[instruction average_time_between_pictos],
[instruction_vocab_size],
[instruction_phrase_average_build_time],
[instruction_phrase_average_size]
]
*/
function
statistics_instruction
(
instruction_pos
,
method_pos
){
var
instruction_statistic
=
[[],[],
[],[],[],[],[],
0
,
0
,
0
,
0
,
0
,
0
];
var
working_sessions
=
[];
//Get the selected instruction's working sessions by date
...
...
@@ -389,9 +349,6 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
}
}
var
instruction_error_rate
=
0
;
var
instruction_tries_average_time
=
0
;
var
instruction_pictos_average_time
=
0
;
var
instruction_phrase_average_size
=
0
;
var
instruction_phrase_average_build_time
=
0
;
for
(
var
i
=
0
;
i
<
working_sessions
.
length
;
i
++
){
...
...
@@ -438,7 +395,6 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
if
(
working_sessions
[
i
].
tries
[
j
].
actions
.
length
>
0
){
var
average_time_pictos_action
=
0
;
var
phrase_average_size_action
=
0
;
var
before
=
moment
(
new
Date
(
working_sessions
[
i
].
tries
[
j
].
actions
[
0
].
timestamp
),
"DD/MM/YYYY HH:mm:ss"
);
for
(
var
k
=
1
;
k
<
working_sessions
[
i
].
tries
[
j
].
actions
.
length
;
k
++
){
...
...
@@ -468,42 +424,27 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
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
;
instruction_error_rate
+=
error_rate
;
tries_average_time
=
tries_average_time
/
working_sessions
[
i
].
tries
.
length
;
//average time per trie per ws
instruction_tries_average_time
+=
tries_average_time
;
average_time_pictos_ws
=
average_time_pictos_ws
/
working_sessions
[
i
].
tries
.
length
;
instruction_pictos_average_time
+=
average_time_pictos_ws
;
phrase_average_build_time
=
phrase_average_build_time
/
working_sessions
[
i
].
tries
.
length
;
//milliseconds
instruction_phrase_average_build_time
+=
phrase_average_build_time
;
//milliseconds
phrase_average_size
=
phrase_average_size
/
working_sessions
[
i
].
tries
.
length
;
instruction_phrase_average_size
+=
phrase_average_size
;
instruction_statistic
[
0
].
push
(
moment
(
working_sessions
[
i
].
begin
).
format
(
"YYYY-MM-DD"
));
//https://github.com/moment/moment/issues/1407
instruction_statistic
[
1
].
push
(
round
((
1
-
error_rate
)
*
100
,
2
));
instruction_statistic
[
2
].
push
(
round
(
moment
.
duration
(
tries_average_time
).
asSeconds
(),
2
));
instruction_statistic
[
3
].
push
(
round
(
moment
.
duration
(
average_time_pictos_ws
).
asSeconds
(),
2
));
instruction_statistic
[
4
].
push
(
$scope
.
vocab_size_aux
.
length
);
instruction_statistic
[
5
].
push
(
round
(
moment
.
duration
(
phrase_average_build_time
).
asSeconds
(),
2
));
instruction_statistic
[
6
].
push
(
phrase_average_size
);
phrase_average_build_time
=
phrase_average_build_time
/
success
;
//milliseconds
phrase_average_size
=
phrase_average_size
/
success
;
$scope
.
method_chart_dates
[
0
].
push
(
moment
(
working_sessions
[
i
].
begin
).
format
(
"YYYY-MM-DD"
));
//https://github.com/moment/moment/issues/1407
$scope
.
error_rate_rate
[
0
].
push
(
round
((
1
-
error_rate
)
*
100
,
2
));
$scope
.
average_time_trie
[
0
].
push
(
round
(
moment
.
duration
(
tries_average_time
).
asSeconds
(),
2
));
$scope
.
average_time_pictos
[
0
].
push
(
round
(
moment
.
duration
(
average_time_pictos_ws
).
asSeconds
(),
2
));
$scope
.
vocab_size
[
0
].
push
(
$scope
.
vocab_size_aux
.
length
);
$scope
.
phrase_average_time
[
0
].
push
(
round
(
moment
.
duration
(
phrase_average_build_time
).
asSeconds
(),
2
));
$scope
.
phrase_average_size
[
0
].
push
(
phrase_average_size
);
}
instruction_statistic
[
7
]
=
round
(((
1
-
instruction_error_rate
)
/
working_sessions
.
length
)
*
100
,
2
);
instruction_statistic
[
8
]
=
round
(
moment
.
duration
(
instruction_tries_average_time
/
working_sessions
.
length
).
asSeconds
()
,
2
);
instruction_statistic
[
9
]
=
round
(
moment
.
duration
(
instruction_pictos_average_time
/
working_sessions
.
length
).
asSeconds
(),
2
);
instruction_statistic
[
10
]
=
$scope
.
vocab_size_aux
.
length
;
instruction_statistic
[
11
]
=
round
(
moment
.
duration
(
instruction_phrase_average_build_time
/
working_sessions
.
length
).
asSeconds
(),
2
);
instruction_statistic
[
12
]
=
round
(
instruction_phrase_average_size
/
working_sessions
.
length
,
2
);
return
instruction_statistic
;
}
function
round
(
number
,
places
)
{
...
...
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