Example #1
0
  private Map<CurricularYear, Inar> generateInarByCurricularYear(YearViewBean bean) {
    Map<CurricularYear, Inar> result =
        new TreeMap<CurricularYear, Inar>(
            new Comparator() {
              @Override
              public int compare(Object year1, Object year2) {
                return ((CurricularYear) year1)
                    .getYear()
                    .compareTo(((CurricularYear) year2).getYear());
              }
            });
    int years = bean.getDegreeCurricularPlan().getDegree().getDegreeType().getYears();
    for (int i = 1; i <= years; i++) {
      Inar inar = new Inar();
      result.put(CurricularYear.readByYear(i), inar);
    }

    for (Enrolment enrol : bean.getEnrolments()) {
      CurricularYear year = CurricularYear.readByYear(enrol.getRegistration().getCurricularYear());
      result.get(year).incEnrolled();
      Grade grade = enrol.getGrade();
      if (grade == null || grade.isEmpty()) {
        result.get(year).incFrequenting();
      } else if (grade.isApproved()) {
        result.get(year).incApproved();
      } else if (grade.isNotEvaluated()) {
        result.get(year).incNotEvaluated();
      } else if (grade.isNotApproved()) {
        result.get(year).incFlunked();
      }
    }

    return result;
  }
Example #2
0
  private Map<BranchCourseGroup, Inar> generateInarByBranch(YearViewBean bean, BranchType bType) {
    Map<BranchCourseGroup, Inar> result =
        new TreeMap<BranchCourseGroup, Inar>(BranchCourseGroup.COMPARATOR_BY_NAME);
    Set<BranchCourseGroup> branches = bean.getDegreeCurricularPlan().getBranchesByType(bType);

    for (BranchCourseGroup branch : branches) {
      Inar inar = new Inar();
      result.put(branch, inar);
    }

    for (Enrolment enrol : bean.getEnrolments()) {
      BranchCourseGroup branch =
          enrol.getParentBranchCurriculumGroup() != null
              ? enrol.getParentBranchCurriculumGroup().getDegreeModule()
              : null;
      if (branch != null && branch.getBranchType() == bType) {
        result.get(branch).incEnrolled();
        Grade grade = enrol.getGrade();
        if (grade == null || grade.isEmpty()) {
          result.get(branch).incFrequenting();
        } else if (grade.isApproved()) {
          result.get(branch).incApproved();
        } else if (grade.isNotEvaluated()) {
          result.get(branch).incNotEvaluated();
        } else if (grade.isNotApproved()) {
          result.get(branch).incFlunked();
        }
      }
    }

    return result;
  }
Example #3
0
  private Inar generateINAR(YearViewBean bean) {
    Inar inar = new Inar();

    for (Enrolment enrol : bean.getEnrolments()) {
      inar.incEnrolled();
      Grade grade = enrol.getGrade();
      if (grade == null || grade.isEmpty()) {
        inar.incFrequenting();
      } else if (grade.isApproved()) {
        inar.incApproved();
      } else if (grade.isNotEvaluated()) {
        inar.incNotEvaluated();
      } else if (grade.isNotApproved()) {
        inar.incFlunked();
      }
    }

    return inar;
  }