for (StudentCurricularPlan studentCurricularPlan : getStudentCurricularPlans()) { for (Enrolment enrolment : studentCurricularPlan.getEnrolments()) { if (enrolment.getEnrolmentCondition() == EnrollmentCondition.INVISIBLE) { continue; }  ExecutionYear enrolmentExecutionYear = enrolment.getExecutionPeriod().getExecutionYear(); if (onlyPreviousExecutionYear && (previousExecutionYear != enrolmentExecutionYear)) { continue; }  if (enrolmentExecutionYear != currentExecutionYear) {  enrollmentsNumber++; if (enrolment.getEnrollmentState() == EnrollmentState.APROVED) { actualApprovedEnrollmentsNumber++;  Integer finalGrade = enrolment.getFinalGrade(); if (finalGrade != null) { approvedEnrollmentsNumber++; totalGrade += finalGrade; } else { enrollmentsNumber--; } } } }
for (StudentCurricularPlan studentCurricularPlan : getStudentCurricularPlans()) { for (Enrolment enrolment : studentCurricularPlan.getEnrolments()) { if (enrolment.getEnrolmentCondition() == EnrollmentCondition.INVISIBLE) { continue;
	public void calculateApprovationRatioAndArithmeticMeanIfActive(boolean onlyPreviousExecutionYear) {		int enrollmentsNumber = 0;		int approvedEnrollmentsNumber = 0;		int actualApprovedEnrollmentsNumber = 0;		int totalGrade = 0;		ExecutionYear currentExecutionYear = ExecutionYear.readCurrentExecutionYear();		ExecutionYear previousExecutionYear = currentExecutionYear.getPreviousExecutionYear();		for (StudentCurricularPlan studentCurricularPlan : getStudentCurricularPlans()) {			for (Enrolment enrolment : studentCurricularPlan.getEnrolments()) {				if (enrolment.getEnrolmentCondition() == EnrollmentCondition.INVISIBLE) {					continue;				}				ExecutionYear enrolmentExecutionYear = enrolment.getExecutionPeriod().getExecutionYear();				if (onlyPreviousExecutionYear && (previousExecutionYear != enrolmentExecutionYear)) {					continue;				}				if (enrolmentExecutionYear != currentExecutionYear) {					enrollmentsNumber++;					if (enrolment.getEnrollmentState() == EnrollmentState.APROVED) {						actualApprovedEnrollmentsNumber++;						Integer finalGrade = enrolment.getFinalGrade();						if (finalGrade != null) {							approvedEnrollmentsNumber++;							totalGrade += finalGrade;						} else {							enrollmentsNumber--;						}					}				}			}		}		setApprovedEnrollmentsNumber(Integer.valueOf(actualApprovedEnrollmentsNumber));		setApprovationRatio((enrollmentsNumber == 0) ? 0 : (double) approvedEnrollmentsNumber				/ enrollmentsNumber);		setArithmeticMean((approvedEnrollmentsNumber == 0) ? 0 : (double) totalGrade				/ approvedEnrollmentsNumber);	}