/** * This method checks conditions of repetition. * * @param Student $student * @param StudentCareerSchoolYear $student_career_school_year * @return boolean */ public function checkRepeationCondition(Student $student, StudentCareerSchoolYear $student_career_school_year) { //If current year is the last year of the career. if ($student_career_school_year->isLastYear()) { return false; } $career_school_year = $student_career_school_year->getCareerSchoolYear(); $last_year_previous = StudentRepprovedCourseSubjectPeer::countRepprovedForStudentAndCareerAndYear($student, $career_school_year->getCareer(), $student_career_school_year->getYear() - 1); if ($last_year_previous > 0) { return true; } //If Previous count > max count of repproved subject allowed, then the student will repeat or go to pathways programs $previous = StudentRepprovedCourseSubjectPeer::countRepprovedForStudentAndCareer($student, $student_career_school_year->getCareerSchoolYear()->getCareer()); return $previous > $career_school_year->getSubjectConfiguration()->getMaxPrevious(); }