Add list of students with 75 assistance

This commit is contained in:
Rey Reyes
2016-04-26 12:04:47 -04:30
parent 54cd4a79c8
commit 38aaff259a
2 changed files with 33 additions and 6 deletions

View File

@@ -16,8 +16,11 @@
vm.positive = 0; vm.positive = 0;
vm.professor = null; vm.professor = null;
vm.students = []; vm.students = [];
vm.studentsPassed = [];
vm.negative = 0; vm.negative = 0;
vm.flag = false; vm.flag = false;
vm.positiveTotal = 0;
vm.negativeTotal = 0;
professors.get({ id: professorid }, professors.get({ id: professorid },
function (successResult){ function (successResult){
@@ -45,9 +48,11 @@
vm.subTotal = vm.positive + vm.negative; vm.subTotal = vm.positive + vm.negative;
}); });
if(((vm.positive/vm.subTotal)*100)<75){ if(((vm.positive/vm.subTotal)*100)<75){
vm.students.push(value); vm.students.push(value);
vm.flag = true; vm.flag = true;
}; }else{
vm.studentsPassed.push(value);
}
vm.positiveTotal = vm.positiveTotal + vm.positive; vm.positiveTotal = vm.positiveTotal + vm.positive;
vm.negativeTotal = vm.negativeTotal + vm.negative; vm.negativeTotal = vm.negativeTotal + vm.negative;
vm.positive = 0; vm.positive = 0;
@@ -55,7 +60,7 @@
vm.subTotal = 0; vm.subTotal = 0;
}); });
vm.total = vm.positiveTotal + vm.negativeTotal; vm.total = vm.positiveTotal + vm.negativeTotal;
vm.percentage = (vm.positive/vm.total)*100; vm.percentage = (vm.positiveTotal/vm.total)*100;
}, },
function (){ function (){
console.log("Error al obtener los datos."); console.log("Error al obtener los datos.");

View File

@@ -10,8 +10,7 @@
</div> </div>
<div ng-show="vm.flag"> <div ng-show="vm.flag">
<h4 style="color: red"> Estudiantes con menos de 75% de Asistencia </h4>
<h4> Estudiantes con menos de 75% de Asistencia </h4>
<table class="table table-bordered table-striped"> <table class="table table-bordered table-striped">
<thead> <thead>
<tr> <tr>
@@ -35,6 +34,29 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<h4 style="color: green"> Estudiantes con más 75% de Asistencia </h4>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th width="20%" style="text-align: center">
Cedula
</th>
<th width="20%" style="text-align: center">
Nombre
</th>
<th width="20%" style="text-align: center">
Apellido
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="student in vm.studentsPassed">
<td style="vertical-align:middle">{{ student.id }}</td>
<td style="vertical-align:middle">{{ student.name }}</td>
<td style="vertical-align:middle">{{ student.lastname }}</td>
</tr>
</tbody>
</table>
<button class = "btn-warning btn" <button class = "btn-warning btn"
type = "button" type = "button"