public function getTotalAbsences($career_school_year_id, $period, $course_subject_id = null, $exclude_justificated = true, $student_id)
 {
     $absences = $this->getAbsences($career_school_year_id, $student_id, $period, $course_subject_id);
     $rounder = new StudentAttendanceRounder();
     $total = 0;
     foreach ($absences as $absence) {
         if ($exclude_justificated) {
             $justificated = $absence->getStudentAttendanceJustification();
             if (!is_null($justificated)) {
                 $cant = $justificated->countStudentAttendances();
                 if ($justificated->countStudentAttendances() >= 5 && $justificated->countStudentAttendances() < 7) {
                     $total += 0.5;
                 } elseif ($justificated->countStudentAttendances() < 5) {
                     $total += $absence->getValue();
                     $rounder->process($absence);
                 }
             } else {
                 $total += $absence->getValue();
                 $rounder->process($absence);
             }
         } else {
             $total += $absence->getValue();
             $rounder->process($absence);
         }
     }
     $diff = $rounder->calculateDiff();
     return $total + $diff;
 }
 public function getTotalAbsences($career_school_year_id, $period = null, $course_subject_id = null, $exclude_justificated = true, $student_id)
 {
     $absences = $this->getAbsences($career_school_year_id, $student_id, $period, $course_subject_id, $exclude_justificated);
     $rounder = new StudentAttendanceRounder();
     $total = 0;
     foreach ($absences as $absence) {
         // sacamos las justificadas, es decir se quiere el total SIN las justificadas
         if ($exclude_justificated && $absence->hasJustification()) {
             continue;
         } else {
             $total += $absence->getValue();
             $rounder->process($absence);
         }
     }
     $diff = $rounder->calculateDiff();
     return $total + $diff;
 }