2016-04-11 00:05:59 -04:30
|
|
|
(function(){
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
angular
|
|
|
|
|
.module('app.reports')
|
|
|
|
|
.controller('SectionAssistCtrl', SectionAssistCtrl)
|
|
|
|
|
|
|
|
|
|
SectionAssistCtrl.$inject =
|
2016-05-20 23:00:34 -04:00
|
|
|
['$scope', '$state', 'professors', '$modal', 'selectedCourse', 'selectedSection', 'selectedStudent', 'authentication'];
|
|
|
|
|
function SectionAssistCtrl($scope, $state, professors, $modal, selectedCourse, selectedSection, selectedStudent, authentication) {
|
2016-04-11 00:05:59 -04:30
|
|
|
var vm = this;
|
2016-05-20 23:00:34 -04:00
|
|
|
var user = authentication.currentUser();
|
|
|
|
|
var professorid = user._id;
|
2016-04-11 00:05:59 -04:30
|
|
|
vm.section = [];
|
|
|
|
|
vm.lectures = 0;
|
|
|
|
|
vm.percentage = 0;
|
|
|
|
|
vm.positive = 0;
|
|
|
|
|
vm.professor = null;
|
2016-04-26 11:33:52 -04:30
|
|
|
vm.students = [];
|
2016-04-26 12:04:47 -04:30
|
|
|
vm.studentsPassed = [];
|
2016-04-11 00:05:59 -04:30
|
|
|
vm.negative = 0;
|
2016-04-26 11:33:52 -04:30
|
|
|
vm.flag = false;
|
2016-04-26 12:04:47 -04:30
|
|
|
vm.positiveTotal = 0;
|
|
|
|
|
vm.negativeTotal = 0;
|
2016-04-11 00:05:59 -04:30
|
|
|
|
|
|
|
|
professors.get({ id: professorid },
|
|
|
|
|
function (successResult){
|
|
|
|
|
vm.professor = successResult;
|
|
|
|
|
angular.forEach (vm.professor.courses[selectedCourse.index].sections,
|
|
|
|
|
function (value, key){
|
|
|
|
|
if (value._id == selectedSection._id ) {
|
|
|
|
|
selectedSection.index = key;
|
|
|
|
|
vm.section = value;
|
|
|
|
|
}
|
|
|
|
|
});
|
2016-06-07 22:47:21 -04:00
|
|
|
vm.lectures = vm.section.students[0].assistance;
|
2016-04-11 00:05:59 -04:30
|
|
|
angular.forEach (vm.section.students,
|
|
|
|
|
function (value){
|
2016-06-07 22:47:21 -04:00
|
|
|
|
2016-04-26 11:33:52 -04:30
|
|
|
vm.subTotal = 0;
|
2016-04-11 00:05:59 -04:30
|
|
|
angular.forEach (value.assistanceTotal,
|
|
|
|
|
function (valued){
|
2016-04-26 10:49:49 -04:30
|
|
|
|
2016-04-11 00:05:59 -04:30
|
|
|
if (valued.assistance) {
|
|
|
|
|
vm.positive++;
|
|
|
|
|
} else {
|
|
|
|
|
vm.negative++;
|
|
|
|
|
}
|
2016-04-26 11:33:52 -04:30
|
|
|
vm.subTotal = vm.positive + vm.negative;
|
|
|
|
|
});
|
2016-04-27 20:34:27 -04:30
|
|
|
if(((vm.positive/vm.subTotal)*100)>75){
|
|
|
|
|
vm.studentsPassed.push(value);
|
|
|
|
|
}else{
|
2016-04-26 12:04:47 -04:30
|
|
|
vm.students.push(value);
|
|
|
|
|
vm.flag = true;
|
2016-04-27 20:34:27 -04:30
|
|
|
|
2016-04-26 12:04:47 -04:30
|
|
|
}
|
2016-04-26 11:33:52 -04:30
|
|
|
vm.positiveTotal = vm.positiveTotal + vm.positive;
|
|
|
|
|
vm.negativeTotal = vm.negativeTotal + vm.negative;
|
|
|
|
|
vm.positive = 0;
|
|
|
|
|
vm.negative = 0;
|
|
|
|
|
vm.subTotal = 0;
|
2016-04-11 00:05:59 -04:30
|
|
|
});
|
2016-04-26 11:33:52 -04:30
|
|
|
vm.total = vm.positiveTotal + vm.negativeTotal;
|
2016-04-26 12:04:47 -04:30
|
|
|
vm.percentage = (vm.positiveTotal/vm.total)*100;
|
2016-04-11 00:05:59 -04:30
|
|
|
},
|
|
|
|
|
function (){
|
|
|
|
|
console.log("Error al obtener los datos.");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
vm.back = function (index) {
|
|
|
|
|
$state.go('sectionReport');
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
})();
|