Commit ba8008de by Jose Antonio

Some Fixes

parent ef655788
......@@ -118,7 +118,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
$scope.method_chart_dates=[[]];
$scope.error_rate_rate = [[]];
$scope.average_time_trie = [[]];
$scope.average_time_try = [[]];
$scope.average_time_pictos = [[]];
$scope.vocab_size = [[]];
$scope.vocab_size_aux = [];
......@@ -306,7 +306,7 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
//*** Average time per trie chart***
$scope.labels2 = $scope.method_chart_dates[0];
$scope.series2 = [$translate.instant('seconds')];
$scope.dataChart2 = $scope.average_time_trie;
$scope.dataChart2 = $scope.average_time_try;
//*** Average time between pictos chart***
$scope.labels3 = $scope.method_chart_dates[0];
......@@ -351,7 +351,8 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
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 count = 0;
var success= 0;
var tries_average_time = 0;
var average_time_pictos_ws = 0;
var phrase_average_size = 0;
......@@ -368,8 +369,6 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
//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){
......@@ -381,10 +380,8 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
}
}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;
......@@ -410,8 +407,6 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
}
}
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);
}
};
......@@ -419,14 +414,19 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
switch(working_sessions[i].tries[j].result) {
case "SUCCESS":
$scope.tries_count["success"]++;
count++;
success++;
calc();
break;
case "SUPERVISED SUCCESS":
$scope.tries_count["supervised_success"]++;
count++;
calc();
break;
case "SPONTANEOUS SUCCESS":
$scope.tries_count["spontaneous_success"]++;
count++;
calc();
break;
case "FAIL":
$scope.tries_count["fail"]++;
......@@ -446,23 +446,21 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
default:
$scope.tries_count["null"]++;
}
}
$scope.tries_count["total"]+=working_sessions[i].tries.length;
error_rate = success / 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;
tries_average_time = tries_average_time / count; //average time per trie per ws
average_time_pictos_ws = average_time_pictos_ws / count;
phrase_average_build_time = phrase_average_build_time / count; //milliseconds
phrase_average_size = phrase_average_size / count;
$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_try[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);
$scope.phrase_average_size[0].push(round(phrase_average_size,2));
}
}
......@@ -483,9 +481,9 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
$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_try[0][firstIndex];
$scope.average_time_try[0][firstIndex] = $scope.average_time_try[0][secondIndex];
$scope.average_time_try[0][secondIndex] = temp;
temp=$scope.average_time_pictos[0][firstIndex];
$scope.average_time_pictos[0][firstIndex] = $scope.average_time_pictos[0][secondIndex];
......
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