Commit a6439228 by Jose Antonio

working on reports - dates disordered

dates from JSON are disordered
parent dec4fbee
......@@ -37,11 +37,6 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
$scope.methods = [];
$scope.tries_count = {"total":0, "success":0, "supervised_success":0,
"spontaneous_success":0, "fail":0, "discarded":0, "model":0,
"broken":0, "null":0
};
$scope.error_rate = {dates:[],rate:[]}; // { dates:[2010-02....], rate:[33.3, ...] }
$scope.average_time_trie={dates:[],rate:[]}; // { dates:[2010-02....], rate:[33.3, ...] }
$scope.average_time_pictos={dates:[],rate:[]}; //{ dates:[2010-02....], rate:[33.3, ...] }
......@@ -16155,8 +16150,6 @@ for(var i=0;i<$scope.fulldata.methods.length; i++){
if($scope.reportDateSince > $scope.reportDateTo){
//Mostrar error
console.log("fecha desde mayor que hasta");
//console.log($scope.fulldata.methods[id=$scope.selected_method]);
return;
}
$scope.statistics();
......@@ -16175,7 +16168,6 @@ for(var i=0;i<$scope.fulldata.methods.length; i++){
methods=$scope.fulldata.methods;
}else{
for(var i=0; i< $scope.fulldata.methods.length; i++){
console.log($scope.fulldata.methods[i].id + "==" + $scope.selected_method);
if($scope.fulldata.methods[i].id == parseInt($scope.selected_method.id)){
methods.push($scope.fulldata.methods[i]);
}
......@@ -16191,22 +16183,27 @@ for(var i=0;i<$scope.fulldata.methods.length; i++){
for( var k=0; k < methods[i].instructions[j].working_sessions.length; k++){
if(new Date(methods[i].instructions[j].working_sessions[k].begin).getTime() > $scope.reportDateSince.getTime()
&& new Date(methods[i].instructions[j].working_sessions[k].end).getTime() < $scope.reportDateTo.getTime()){
console.log("ws added");
working_sessions.push(methods[i].instructions[j].working_sessions[k]);
}
}
}
}
$scope.tries_count = {"total":0, "success":0, "supervised_success":0,
"spontaneous_success":0, "fail":0, "discarded":0, "model":0,
"broken":0, "null":0
};
$scope.error_rate_dates = [[]]; // [2010-02....]
$scope.error_rate_rate = [[]]; // [33.3, ...]
for(var i=0; i < working_sessions.length; i++){
console.log(working_sessions[i]);
var error_rate = 0; //error_rate for this working session
var success = 0;
for(var j=0; j < working_sessions[i].tries.length; j++){
switch(working_sessions[i].tries[j].result) {
case "SUCCESS":
$scope.tries_count["success"]++;
sucess++;
success++;
break;
case "SUPERVISED SUCCESS":
$scope.tries_count["supervised_success"]++;
......@@ -16237,8 +16234,8 @@ for(var i=0;i<$scope.fulldata.methods.length; i++){
$scope.tries_count["total"]+=working_sessions[i].tries.length;
error_rate = success / working_sessions[i].tries.length;
$scope.error_rate.dates.push(working_sessions[i].begin);
$scope.error_rate.rate.push(error_rate);
$scope.error_rate_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(Math.round(error_rate * 10000) / 100);
}
......@@ -16273,11 +16270,32 @@ for(var i=0;i<$scope.fulldata.methods.length; i++){
//CHART DATA
//*** Error rate chart***
$scope.labels1 = $scope.error_rate.dates;
$scope.labels1 = $scope.error_rate_dates[0];
$scope.series1 = ['Tasa de error'];
//$scope.dataChart1 = [error_rate];
$scope.dataChart1 = $scope.error_rate.rate;
console.log($scope.error_rate);
$scope.dataChart1 = $scope.error_rate_rate;
$scope.optionsChart1 = {
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'
}
}
]
}
};
//*** Year Chart ***
// $scope.labels2 = $scope.months;
// $scope.series2 = ['Sesiones','Pictogramas','Horas'];
......
......@@ -57,8 +57,7 @@
<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-data="dataChart1" chart-labels="labels1" chart-series="series1"></canvas>
<h3>{{ dataChart1 }} {{ labels1 }}</h3>
<canvas id="bar1" class="chart chart-line" chart-options="optionsChart1" 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>
......
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