Commit 770d3189 by Jose Antonio

reports almost done - dummy data

- quicksort dates
- vocabulary charts
parent 1d4910a9
......@@ -401,6 +401,8 @@
"vibration": "Vibration",
"view": "View",
"voice": "Voice",
"vocabulary": "Vocabulary",
"vocabulary_size": "Vocabulary size",
"warning": "Warning",
"warning_browser_incompatible": "Your browser may not be compatible with Pictogram Web. We recommend using the latest version of",
"warning_last_session_bad": "Last session was interrupted. Please, you must evaluate last tries and press 'close seesion' button",
......
......@@ -401,6 +401,8 @@
"vibration": "Vibración",
"view": "Vista",
"voice": "Voz",
"vocabulary": "Vocabulario",
"vocabulary_size": "Tamaño del vocabulario",
"warning": "Advertencia",
"warning_browser_incompatible": "Su navegador podría ser incompatible con Pictogram Web. Le recomendamos utilizar la última versión de",
"warning_last_session_bad": "La última sesión no se cerró correctamente. Por favor, evalúe los ensayos y pulse 'cerrar sesión' ",
......
......@@ -525,7 +525,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"id": 761,
"begin": "2017-04-09T18:50:13.060Z",
"end": "2017-04-09T18:50:18.000Z",
"result": null,
"result": "SUCCESS",
"description": null,
"workingSession": 241
}
......@@ -621,7 +621,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"id": 773,
"begin": "2017-03-09T18:53:51.933Z",
"end": "2017-03-09T18:53:54.000Z",
"result": null,
"result": "SUCCESS",
"description": null,
"workingSession": 243
},
......@@ -706,7 +706,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"id": 772,
"begin": "2017-03-09T18:53:48.284Z",
"end": "2017-03-09T18:53:51.000Z",
"result": null,
"result": "SUCCESS",
"description": null,
"workingSession": 243
},
......@@ -780,7 +780,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"id": 774,
"begin": "2017-03-09T18:53:54.431Z",
"end": "2017-03-09T18:53:57.000Z",
"result": null,
"result": "SUCCESS",
"description": null,
"workingSession": 243
},
......@@ -854,7 +854,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"id": 775,
"begin": "2017-03-09T18:53:58.079Z",
"end": "2017-03-09T18:54:03.000Z",
"result": null,
"result": "SUCCESS",
"description": null,
"workingSession": 243
},
......@@ -1021,7 +1021,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"id": 776,
"begin": "2017-03-09T18:54:03.781Z",
"end": "2017-03-09T18:54:19.000Z",
"result": null,
"result": "SUCCESS",
"description": null,
"workingSession": 243
},
......@@ -1095,7 +1095,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"id": 777,
"begin": "2017-03-09T18:54:20.018Z",
"end": "2017-03-09T18:54:32.000Z",
"result": null,
"result": "SUCCESS",
"description": null,
"workingSession": 243
},
......@@ -1231,7 +1231,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"id": 779,
"begin": "2017-03-09T18:54:38.387Z",
"end": "2017-03-09T18:55:09.000Z",
"result": null,
"result": "SUCCESS",
"description": null,
"workingSession": 243
},
......@@ -1305,7 +1305,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"id": 778,
"begin": "2017-03-09T18:54:32.456Z",
"end": "2017-03-09T18:54:38.000Z",
"result": null,
"result": "SUCCESS",
"description": null,
"workingSession": 243
},
......@@ -1379,7 +1379,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"id": 780,
"begin": "2017-03-09T18:55:09.655Z",
"end": "2017-03-09T18:55:18.000Z",
"result": null,
"result": "SUCCESS",
"description": null,
"workingSession": 243
},
......@@ -1453,7 +1453,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"id": 781,
"begin": "2017-03-09T18:55:19.583Z",
"end": "2017-03-09T18:55:29.000Z",
"result": null,
"result": "SUCCESS",
"description": null,
"workingSession": 243
},
......@@ -1683,7 +1683,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"id": 782,
"begin": "2017-03-09T18:55:29.617Z",
"end": "2017-03-09T18:55:47.000Z",
"result": null,
"result": "SUCCESS",
"description": null,
"workingSession": 243
},
......@@ -1851,7 +1851,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"id": 783,
"begin": "2017-03-09T18:55:47.381Z",
"end": "2017-03-09T18:55:54.000Z",
"result": null,
"result": "SUCCESS",
"description": null,
"workingSession": 243
},
......@@ -2009,7 +2009,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"id": 784,
"begin": "2017-03-09T18:55:54.197Z",
"end": "2017-03-09T18:56:27.000Z",
"result": null,
"result": "SUCCESS",
"description": null,
"workingSession": 243
}
......@@ -2029,8 +2029,8 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"name": "Fase 4 - Estructura de la oración",
"objective": "El estudiante solicita artículos presentes y no presentes usando una frase de varias palabras yendo al libro.El estudiante toma una fotografía/símbolo de \"Yo quiero\" y la coloca en una línea de frase (tira de Velcro). Luego, el estudiante toma una imagen de lo que desea, la coloca en la línea de frase, quita toda la tira de Velcro, y la lleva a su interlocutor.",
"status": "started",
"begin": "2017-03-09T18:51:26.297Z",
"end": "2017-03-09T18:51:26.297Z",
"begin": "2017-03-08T18:51:26.297Z",
"end": "2017-03-08T18:51:26.297Z",
"method": 38,
"working_sessions": [
{
......@@ -2040,7 +2040,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6366,
"type": "initsession",
"timestamp": "2017-03-09T18:50:50.000Z",
"timestamp": "2017-03-08T18:50:50.000Z",
"description": null,
"gpsLat": null,
"gpsLon": null,
......@@ -2051,7 +2051,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6367,
"type": "Add",
"timestamp": "2017-03-09T18:51:28.000Z",
"timestamp": "2017-03-08T18:51:28.000Z",
"description": {
"id": 1470,
"picto": {
......@@ -2082,7 +2082,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6368,
"type": "Show",
"timestamp": "2017-03-09T18:51:29.000Z",
"timestamp": "2017-03-08T18:51:29.000Z",
"description": [
{
"id": 1470,
......@@ -2114,9 +2114,9 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
}
],
"id": 765,
"begin": "2017-03-09T18:51:26.297Z",
"end": "2017-03-09T18:51:29.000Z",
"result": null,
"begin": "2017-03-08T18:51:26.297Z",
"end": "2017-03-08T18:51:29.000Z",
"result": "SUCCESS",
"description": null,
"workingSession": 242
},
......@@ -2125,7 +2125,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6369,
"type": "Add",
"timestamp": "2017-03-09T18:51:31.000Z",
"timestamp": "2017-03-08T18:51:31.000Z",
"description": {
"id": 1470,
"picto": {
......@@ -2156,7 +2156,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6371,
"type": "Add",
"timestamp": "2017-03-09T18:51:33.000Z",
"timestamp": "2017-03-08T18:51:33.000Z",
"description": {
"id": 1470,
"picto": {
......@@ -2187,7 +2187,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6373,
"type": "Add",
"timestamp": "2017-03-09T18:51:39.000Z",
"timestamp": "2017-03-08T18:51:39.000Z",
"description": {
"id": 1470,
"picto": {
......@@ -2218,7 +2218,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6375,
"type": "Add",
"timestamp": "2017-03-09T18:51:41.000Z",
"timestamp": "2017-03-08T18:51:41.000Z",
"description": {
"id": 1470,
"picto": {
......@@ -2249,7 +2249,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6376,
"type": "Show",
"timestamp": "2017-03-09T18:51:42.000Z",
"timestamp": "2017-03-08T18:51:42.000Z",
"description": [
{
"id": 1470,
......@@ -2281,9 +2281,9 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
}
],
"id": 766,
"begin": "2017-03-09T18:51:29.235Z",
"end": "2017-03-09T18:51:42.000Z",
"result": null,
"begin": "2017-03-08T18:51:29.235Z",
"end": "2017-03-08T18:51:42.000Z",
"result": "SUCCESS",
"description": null,
"workingSession": 242
},
......@@ -2292,7 +2292,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6377,
"type": "Add",
"timestamp": "2017-03-09T18:51:44.000Z",
"timestamp": "2017-03-08T18:51:44.000Z",
"description": {
"id": 1470,
"picto": {
......@@ -2323,7 +2323,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6379,
"type": "Add",
"timestamp": "2017-03-09T18:51:46.000Z",
"timestamp": "2017-03-08T18:51:46.000Z",
"description": {
"id": 1470,
"picto": {
......@@ -2354,7 +2354,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6380,
"type": "Show",
"timestamp": "2017-03-09T18:51:47.000Z",
"timestamp": "2017-03-08T18:51:47.000Z",
"description": [
{
"id": 1470,
......@@ -2386,9 +2386,9 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
}
],
"id": 767,
"begin": "2017-03-09T18:51:42.253Z",
"end": "2017-03-09T18:51:47.000Z",
"result": null,
"begin": "2017-03-08T18:51:42.253Z",
"end": "2017-03-08T18:51:47.000Z",
"result": "SUCCESS",
"description": null,
"workingSession": 242
},
......@@ -2397,7 +2397,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6381,
"type": "Add",
"timestamp": "2017-03-09T18:51:49.000Z",
"timestamp": "2017-03-08T18:51:49.000Z",
"description": {
"id": 1470,
"picto": {
......@@ -2428,7 +2428,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6383,
"type": "Add",
"timestamp": "2017-03-09T18:51:51.000Z",
"timestamp": "2017-03-08T18:51:51.000Z",
"description": {
"id": 1470,
"picto": {
......@@ -2459,7 +2459,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6384,
"type": "Show",
"timestamp": "2017-03-09T18:51:52.000Z",
"timestamp": "2017-03-08T18:51:52.000Z",
"description": [
{
"id": 1470,
......@@ -2491,9 +2491,9 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
}
],
"id": 768,
"begin": "2017-03-09T18:51:47.747Z",
"end": "2017-03-09T18:51:52.000Z",
"result": null,
"begin": "2017-03-08T18:51:47.747Z",
"end": "2017-03-08T18:51:52.000Z",
"result": "SUCCESS",
"description": null,
"workingSession": 242
},
......@@ -2502,7 +2502,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6389,
"type": "Add",
"timestamp": "2017-03-09T18:51:58.000Z",
"timestamp": "2017-03-08T18:51:58.000Z",
"description": {
"id": 1470,
"picto": {
......@@ -2533,7 +2533,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6391,
"type": "Add",
"timestamp": "2017-03-09T18:52:00.000Z",
"timestamp": "2017-03-08T18:52:00.000Z",
"description": {
"id": 1470,
"picto": {
......@@ -2564,7 +2564,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6393,
"type": "Add",
"timestamp": "2017-03-09T18:52:02.000Z",
"timestamp": "2017-03-08T18:52:02.000Z",
"description": {
"id": 1470,
"picto": {
......@@ -2595,7 +2595,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6394,
"type": "Show",
"timestamp": "2017-03-09T18:52:03.000Z",
"timestamp": "2017-03-08T18:52:03.000Z",
"description": [
{
"id": 1470,
......@@ -2627,9 +2627,9 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
}
],
"id": 770,
"begin": "2017-03-09T18:51:57.258Z",
"end": "2017-03-09T18:52:03.000Z",
"result": null,
"begin": "2017-03-08T18:51:57.258Z",
"end": "2017-03-08T18:52:03.000Z",
"result": "SUCCESS",
"description": null,
"workingSession": 242
},
......@@ -2638,7 +2638,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6385,
"type": "Add",
"timestamp": "2017-03-09T18:51:54.000Z",
"timestamp": "2017-03-08T18:51:54.000Z",
"description": {
"id": 1470,
"picto": {
......@@ -2669,7 +2669,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6387,
"type": "Add",
"timestamp": "2017-03-09T18:51:56.000Z",
"timestamp": "2017-03-08T18:51:56.000Z",
"description": {
"id": 1470,
"picto": {
......@@ -2700,7 +2700,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
{
"id": 6388,
"type": "Show",
"timestamp": "2017-03-09T18:51:57.000Z",
"timestamp": "2017-03-08T18:51:57.000Z",
"description": [
{
"id": 1470,
......@@ -2732,16 +2732,16 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
}
],
"id": 769,
"begin": "2017-03-09T18:51:52.392Z",
"end": "2017-03-09T18:51:57.000Z",
"result": null,
"begin": "2017-03-08T18:51:52.392Z",
"end": "2017-03-08T18:51:57.000Z",
"result": "SUCCESS",
"description": null,
"workingSession": 242
}
],
"id": 242,
"begin": "2017-03-09T18:50:50.000Z",
"end": "2017-03-09T18:52:24.000Z",
"begin": "2017-03-08T18:50:50.000Z",
"end": "2017-03-08T18:52:24.000Z",
"current": null,
"description": "",
"supervisor": 23,
......@@ -2841,7 +2841,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"id": 786,
"begin": "2017-03-09T18:56:40.334Z",
"end": "2017-03-09T18:56:44.000Z",
"result": null,
"result": "SUCCESS",
"description": null,
"workingSession": 244
},
......@@ -2915,7 +2915,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"id": 788,
"begin": "2017-03-09T18:56:55.724Z",
"end": "2017-03-09T18:57:07.000Z",
"result": null,
"result": "SUCCESS",
"description": null,
"workingSession": 244
},
......@@ -3082,7 +3082,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"id": 787,
"begin": "2017-03-09T18:56:44.810Z",
"end": "2017-03-09T18:56:55.000Z",
"result": null,
"result": "SUCCESS",
"description": null,
"workingSession": 244
},
......@@ -3156,7 +3156,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"id": 789,
"begin": "2017-03-09T18:57:08.085Z",
"end": "2017-03-09T18:57:10.000Z",
"result": null,
"result": "SUCCESS",
"description": null,
"workingSession": 244
},
......@@ -3261,7 +3261,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
"id": 790,
"begin": "2017-03-09T18:57:11.042Z",
"end": "2017-03-09T18:57:19.000Z",
"result": null,
"result": "SUCCESS",
"description": null,
"workingSession": 244
}
......@@ -3363,6 +3363,9 @@ for(var i =0; i<$scope.fulldata.methods.length; i++){
$scope.error_rate_rate = []; // [33.3, ...]
$scope.average_time_trie = []; // [3, 4,...] seconds
$scope.average_time_pictos = [];
$scope.vocab_size = [];
$scope.phrase_average_time= [];
$scope.phrase_average_size = [];
if(selected_method.class === "method-opt"){
//check the selected method
......@@ -3381,15 +3384,22 @@ for(var i =0; i<$scope.fulldata.methods.length; i++){
var error_rate = [[]];
var average_time_trie = [[]];
var average_time_pictos = [[]];
var vocab_size = [[]];
var phrase_average_time = [[]];
var 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);
average_time_trie[0].push(statistics[5]);
average_time_pictos[0].push(statistics[6]);
error_rate[0].push(statistics[4]);
error_rate[0].push(statistics[7]);
average_time_trie[0].push(statistics[8]);
average_time_pictos[0].push(statistics[9]);
vocab_size[0].push(statistics[10]);
phrase_average_time[0].push(statistics[11]);
phrase_average_size[0].push(statistics[12]);
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"));
......@@ -3400,6 +3410,9 @@ for(var i =0; i<$scope.fulldata.methods.length; i++){
$scope.error_rate_rate = error_rate;
$scope.average_time_trie = average_time_trie;
$scope.average_time_pictos = average_time_pictos;
$scope.vocab_size = vocab_size;
$scope.phrase_average_size = phrase_average_size;
$scope.phrase_average_time = phrase_average_time;
}else{
//check the selected method
......@@ -3423,12 +3436,20 @@ for(var i =0; i<$scope.fulldata.methods.length; i++){
$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]);
}
}
}
}
//Ordenar arrays por fechas
$scope.method_chart_dates[0] = quickSort(
$scope.method_chart_dates[0], 0, $scope.method_chart_dates[0].length - 1);
//CHART DATA
//*** Error rate chart***
$scope.labels1 = $scope.method_chart_dates[0];
......@@ -3436,28 +3457,61 @@ for(var i =0; i<$scope.fulldata.methods.length; i++){
//$scope.dataChart1 = [error_rate];
$scope.dataChart1 = $scope.error_rate_rate;
$scope.optionsChartTime = {
elements:{
line:{
tension: 0,
lineTension:0
},
bezierCurve : false,
},
scales: {
xAxes: [
{
type: 'time',
time: {
displayFormats: {
'millisecond': 'DD/MM',
'second': 'DD/MM',
'minute': 'DD/MM',
'hour': 'DD/MM',
'day': 'DD/MM',
'month': 'MM/YY',
'quarter': 'MM/YY',
'year': 'YYYY',
},
minUnit: 'day'
id: 'x-axis-dates',
// type: 'linear',
// time: {
// displayFormats: {
// 'millisecond': 'DD/MM',
// 'second': 'DD/MM',
// 'minute': 'DD/MM',
// 'hour': 'DD/MM',
// 'day': 'DD/MM',
// 'month': 'MM/YY',
// 'quarter': 'MM/YY',
// 'year': 'YYYY',
// },
// minUnit: 'day'
// }
}
]
}
};
//$scope.datasetOverride = [{ yAxisID: 'y-axis-1' }, { yAxisID: 'y-axis-2' }];
$scope.optionsChartPhrases = {
elements:{
line:{
tension: 0,
lineTension:0
},
bezierCurve : false,
},
scales: {
yAxes: [
{
id: 'y-axis-1',
type: 'linear',
display: true,
position: 'left'
},
{
id: 'y-axis-2',
type: 'linear',
display: true,
position: 'right'
}
]
}
};
//*** Average time per trie chart***
$scope.labels2 = $scope.method_chart_dates[0];
$scope.series2 = ['Segundos'];
......@@ -3467,7 +3521,16 @@ for(var i =0; i<$scope.fulldata.methods.length; i++){
$scope.labels3 = $scope.method_chart_dates[0];
$scope.series3 = ['Segundos'];
$scope.dataChart3 = $scope.average_time_pictos;
console.log($scope.average_time_pictos);
//*** Vocabuary size chart***
$scope.labels4 = $scope.method_chart_dates[0];
$scope.series4 = ['Pictogramas'];
$scope.dataChart4 = $scope.vocab_size;
//*** Vocabuary size chart***
$scope.labels5 = $scope.method_chart_dates[0];
$scope.series5 = ['Longitud media', 'Tiempo medio elaboracion'];
$scope.dataChart5 = [$scope.phrase_average_size[0],$scope.phrase_average_time[0]];
};
......@@ -3475,17 +3538,24 @@ for(var i =0; i<$scope.fulldata.methods.length; i++){
* 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 array [
* 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 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
......@@ -3497,15 +3567,20 @@ for(var i =0; i<$scope.fulldata.methods.length; i++){
working_sessions.push($scope.statistic_methods[method_pos].instructions[instruction_pos].working_sessions[k]);
}
}
var instruction_statistic = [[],[], [],[], 0, 0, 0];
var instruction_error_rate = 0;
var instruction_tries_average_time = 0;
var instruction_pictos_average_time = 0;
var instruction_pictos = [];
var instruction_phrase_average_size = 0;
var instruction_phrase_average_build_time = 0;
for(var i=0; i < working_sessions.length; i++){
var error_rate = 0; //error_rate for this working session
var success = 0;
var tries_average_time = 0;
var average_time_pictos_ws = 0;
var phrase_average_size = 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) {
case "SUCCESS":
......@@ -3520,7 +3595,6 @@ for(var i =0; i<$scope.fulldata.methods.length; i++){
break;
case "FAIL":
$scope.tries_count["fail"]++;
error_rate++;
break;
case "DISCARDED":
$scope.tries_count["discarded"]++;
......@@ -3540,16 +3614,45 @@ for(var i =0; i<$scope.fulldata.methods.length; i++){
var ms = moment(new Date(working_sessions[i].tries[j].end),"DD/MM/YYYY HH:mm:ss").diff(moment(new Date(working_sessions[i].tries[j].begin) ,"DD/MM/YYYY HH:mm:ss"));
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;
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++){
var now = moment(new Date(working_sessions[i].tries[j].actions[k].timestamp),"DD/MM/YYYY HH:mm:ss");
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");
var phrase_end = 0;
if (working_sessions[i].tries[j].actions[k].type == "Delete"){
//The user deleted the last action
instruction_pictos.pop();
count_pictos--;
}else if(working_sessions[i].tries[j].actions[k].type == "Add"){
count_pictos++;
if ( instruction_pictos.indexOf(working_sessions[i].tries[j].actions[k].description.picto.id) == -1 ){
instruction_pictos.push(instruction_pictos.indexOf(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");
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;
}
}
......@@ -3560,15 +3663,26 @@ for(var i =0; i<$scope.fulldata.methods.length; i++){
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(error_rate * 100, 2));
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] = round(((instruction_error_rate / working_sessions.length) * 100), 2);
instruction_statistic[5] = round(moment.duration(instruction_tries_average_time / working_sessions.length ).asSeconds() , 2);
instruction_statistic[6] = round(moment.duration(instruction_pictos_average_time / working_sessions.length ).asSeconds(), 2);
instruction_statistic[4].push(instruction_pictos.length);
instruction_statistic[5].push(round(moment.duration(phrase_average_build_time).asSeconds(),2));
instruction_statistic[6].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] = instruction_pictos.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);
console.log(instruction_statistic);
return instruction_statistic;
}
......@@ -3580,4 +3694,70 @@ for(var i =0; i<$scope.fulldata.methods.length; i++){
return Math.floor(number * m) / m;
}
//Swap dates(items) and all other data arrays
function swap(items, firstIndex, secondIndex){
var temp = items[firstIndex];
items[firstIndex] = items[secondIndex];
items[secondIndex] = temp;
temp=$scope.error_rate_rate[0][firstIndex];
$scope.error_rate_rate[0][firstIndex] = $scope.error_rate_rate[0][secondIndex];
$scope.error_rate_rate[0][secondIndex] = temp;
temp=$scope.average_time_trie[0][firstIndex];
$scope.average_time_trie[0][firstIndex] = $scope.average_time_trie[0][secondIndex];
$scope.average_time_trie[0][secondIndex] = temp;
temp=$scope.average_time_pictos[0][firstIndex];
$scope.average_time_pictos[0][firstIndex] = $scope.average_time_pictos[0][secondIndex];
$scope.average_time_pictos[0][secondIndex] = temp;
temp=$scope.vocab_size[0][firstIndex];
$scope.vocab_size[0][firstIndex] = $scope.vocab_size[0][secondIndex];
$scope.vocab_size[0][secondIndex] = temp;
temp=$scope.phrase_average_size[0][firstIndex];
$scope.phrase_average_size[0][firstIndex] = $scope.phrase_average_size[0][secondIndex];
$scope.phrase_average_size[0][secondIndex] = temp;
temp=$scope.phrase_average_time[0][firstIndex];
$scope.phrase_average_time[0][firstIndex] = $scope.phrase_average_time[0][secondIndex];
$scope.phrase_average_time[0][secondIndex] = temp;
}
function partition(items, left, right) {
var pivot = items[Math.floor((right + left) / 2)],
i = left,
j = right;
while (i <= j) {
while (items[i] < pivot) {
i++;
}
while (items[j] > pivot) {
j--;
}
if (i <= j) {
swap(items, i, j);
i++;
j--;
}
}
return i;
}
function quickSort(items, left, right) {
var index;
if (items.length > 1) {
index = partition(items, left, right);
if (left < index - 1) {
quickSort(items, left, index - 1);
}
if (index < right) {
quickSort(items, index, right);
}
}
return items;
}
});
......@@ -12,7 +12,7 @@
<div class="form-group">
<p class="input-group">
<select class="form-control" name="method_select" id="method_select" ng-model="selected_method">
<option value="-1" selected>{{'select_method' | translate}}</option>
<option value="-1" selected>{{'select_a_method' | translate}}</option>
<option ng-repeat="elem in elems track by $index" class="{{elem.class}}" value="{{elem}}">{{elem.name}}</option>
</select>
</p>
......@@ -53,17 +53,17 @@
<div class="col-lg-4 bg-light-gray">
<h1 class="text-center"><small>{{'error_rate' | translate}}</small></h1>
<hr>
<canvas id="bar1" class="chart chart-line" chart-options="optionsChartTime" chart-data="dataChart1" chart-labels="labels1" chart-series="series1"></canvas>
<canvas id="error_rate" class="chart chart-line" chart-options="optionsChartTime" chart-data="dataChart1" chart-labels="labels1" chart-series="series1"></canvas>
</div>
<div class="col-lg-4">
<h1 class="text-center"><small>{{'average_time_per_try' | translate}}</small></h1>
<hr>
<canvas id="bar2" class="chart chart-line" chart-options="optionsChartTime" chart-data="dataChart2" chart-labels="labels2" chart-series="series2"></canvas>
<canvas id="avg_time_trie" class="chart chart-line" chart-options="optionsChartTime" chart-data="dataChart2" chart-labels="labels2" chart-series="series2"></canvas>
</div>
<div class="col-lg-4 bg-light-gray">
<h1 class="text-center"><small>{{'average_time_between_pictos' | translate}}</small></h1>
<hr>
<canvas id="bar3" class="chart chart-line" chart-options="optionsChartTime" chart-data="dataChart3" chart-labels="labels3" chart-series="series3"></canvas>
<canvas id="avg_time_pictos" class="chart chart-line" chart-options="optionsChartTime" chart-data="dataChart3" chart-labels="labels3" chart-series="series3"></canvas>
</div>
</div>
<div class="row">
......@@ -72,14 +72,14 @@
<tbody>
<tr>
<td>&nbsp;</td>
<td>{{ 'total' | translate }}</td>
<td>{{ 'success' | translate }}</td>
<td>{{ 'supervised_success' | translate }}</td>
<td>{{ 'spontaneous_success' | translate }}</td>
<td>{{ 'fail' | translate }}</td>
<td>{{ 'discarded' | translate }}</td>
<td>{{ 'model' | translate }}</td>
<td>{{ 'broken' | translate }}</td>
<td>{{ 'totals' | translate }}</td>
<td>{{ 'state_correct' | translate }}</td>
<td>{{ 'state_supervised' | translate }}</td>
<td>{{ 'state_spontaneous' | translate }}</td>
<td>{{ 'state_fail' | translate }}</td>
<td>{{ 'state_discarded' | translate }}</td>
<td>{{ 'state_demonstration' | translate }}</td>
<td>{{ 'state_broken' | translate }}</td>
</tr>
<tr>
<td>{{ 'tries' | translate }}</td>
......@@ -96,7 +96,24 @@
</table>
</div>
</div>
<div class="row">
<div class="col-md-4">
<h1>{{'vocabulary' | translate}}</h1>
</div>
</div>
<hr>
<div class="row">
<div class="col-lg-4 bg-light-gray">
<h1 class="text-center"><small>{{'vocabulary_size' | translate}}</small></h1>
<hr>
<canvas id="vocab_size" class="chart chart-line" chart-options="optionsChartTime" chart-data="dataChart4" chart-labels="labels4" chart-series="series4"></canvas>
</div>
<div class="col-lg-4">
<h1 class="text-center"><small>{{'phrase' | translate}}</small></h1>
<hr>
<canvas id="phrases" class="chart chart-line" chart-options="optionsChartPhrases" chart-data="dataChart5" chart-labels="labels5" chart-series="series5"></canvas>
</div>
</div>
</div>
<!-- END .panel-body -->
</div>
......
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 sign in to comment