コード例 #1
0
  private double getEnrolmentsEctsCredits(
      final Registration registration, final ExecutionYear executionYear) {
    double result = 0.0;
    double annualCredits = 0.0;

    for (final ExecutionSemester executionSemester : executionYear.getExecutionPeriodsSet()) {
      for (final Enrolment enrolment :
          registration.getLastStudentCurricularPlan().getEnrolmentsSet()) {
        if (enrolment.isValid(executionSemester)) {
          if (enrolment.isAnual()) {
            this.enrolledInAnualCoursesLastYear = true;

            if (executionSemester.getSemester() == 1) {
              annualCredits += enrolment.getEctsCredits();
            }
            continue;
          }

          result += enrolment.getEctsCredits();
        }
      }
    }

    return result + annualCredits;
  }
コード例 #2
0
  private double getEnrolmentsEctsCredits(final ExecutionYear executionYear) {
    double result = 0.0;
    Set<Enrolment> annualEnrolments = new HashSet<Enrolment>();

    for (final ExecutionSemester executionSemester : executionYear.getExecutionPeriodsSet()) {
      for (final Enrolment enrolment : getStudentCurricularPlan().getEnrolmentsSet()) {
        if (enrolment.isValid(executionSemester) && !annualEnrolments.contains(enrolment)) {
          result += enrolment.getEctsCredits();

          if (enrolment.isAnual()) {
            annualEnrolments.add(enrolment);
          }
        }
      }
    }

    return result;
  }