Esempio n. 1
0
 public StudentInquiriesTeachingResult getStudentInquiriesTeachingResult(
     final ExecutionDegree executionDegree, final ShiftType shiftType) {
   for (StudentInquiriesTeachingResult result : getStudentInquiriesTeachingResults()) {
     if (result.getExecutionDegree() == executionDegree && result.getShiftType() == shiftType) {
       return result;
     }
   }
   return null;
 }
Esempio n. 2
0
  /**
   * Ver onde sao guardados os StudentInquiries (QUC): ir por CurricularCourses
   *
   * <p>1. Extrair o ED 2. A partir do ED extrair duas collections: CourseResults e TeacherResults
   * 3. Magia para tirar um score desses results (ainda nao sei o q possa ser esse score. vou
   * extrair o 'average_NDE' e 'average_P6_1' apenas a titulo de exemplo. nao tem qq valor real. os
   * values sao em double, passar a BigDecimals e trabalhar sempre neste format). 4. Aplicar 50% à
   * media do score de todos os CourseResults e 50% à media do score de todos os TeacherResults 5.
   * Mostrar esse score.
   */
  private String generateQUCResults(YearViewBean bean) {
    ExecutionDegree executionDegree =
        ExecutionDegree.getByDegreeCurricularPlanAndExecutionYear(
            bean.getDegreeCurricularPlan(), bean.getExecutionYear());

    Set<StudentInquiriesCourseResult> courseResults =
        executionDegree.getStudentInquiriesCourseResultsSet();
    Set<StudentInquiriesTeachingResult> teachingResults =
        executionDegree.getStudentInquiriesTeachingResultsSet();

    BigDecimal sigmaCR = new BigDecimal(0);
    BigDecimal cardinalityCR = new BigDecimal(0);
    BigDecimal averageCR = new BigDecimal(0);

    BigDecimal sigmaTR = new BigDecimal(0);
    BigDecimal cardinalityTR = new BigDecimal(0);
    BigDecimal averageTR = new BigDecimal(0);

    BigDecimal partialCourse = new BigDecimal(0);
    BigDecimal partialTeaching = new BigDecimal(0);

    String result;

    for (StudentInquiriesCourseResult courseResult : courseResults) {
      BigDecimal converted =
          new BigDecimal(courseResult.getAverage_NDE() != null ? courseResult.getAverage_NDE() : 0);
      sigmaCR = sigmaCR.add(converted);
      cardinalityCR = cardinalityCR.add(BigDecimal.ONE);
    }
    if (cardinalityCR.compareTo(BigDecimal.ZERO) != 0) {
      averageCR = sigmaCR.divide(cardinalityCR, 4, RoundingMode.HALF_EVEN);
    } else {
      averageCR = BigDecimal.ZERO;
    }

    for (StudentInquiriesTeachingResult teachingResult : teachingResults) {
      BigDecimal converted =
          new BigDecimal(
              teachingResult.getAverage_P6_1() != null ? teachingResult.getAverage_P6_1() : 0);
      sigmaTR = sigmaTR.add(converted);
      cardinalityTR = cardinalityTR.add(BigDecimal.ONE);
    }
    if (cardinalityCR.compareTo(BigDecimal.ZERO) != 0) {
      averageTR = sigmaTR.divide(cardinalityTR, 4, RoundingMode.HALF_EVEN);
    } else {
      averageTR = BigDecimal.ZERO;
    }

    partialCourse = averageCR.divide(new BigDecimal(2), 2, RoundingMode.HALF_EVEN);
    partialTeaching = averageTR.divide(new BigDecimal(2), 2, RoundingMode.HALF_EVEN);

    result = partialCourse.add(partialTeaching).toPlainString();

    return result;
  }