示例#1
0
 private boolean containsShiftType(AffiliatedTeacherDTO teacherDTO, ShiftType shiftType) {
   for (StudentTeacherInquiryBean studentTeacherInquiryBean :
       getTeachersInquiries().get(teacherDTO)) {
     if (studentTeacherInquiryBean.getShiftType() == shiftType) {
       return true;
     }
   }
   return false;
 }
示例#2
0
  @Atomic
  public void setAnsweredInquiry() {
    if (getInquiryRegistry().getState() == InquiriesRegistryState.ANSWERED) {
      return;
    }
    InquiryCourseAnswer inquiryCourseAnswer = new InquiryCourseAnswer();
    DateTime endTime = new DateTime();
    inquiryCourseAnswer.setAnswerDuration(endTime.getMillis() - getStartedWhen().getMillis());
    inquiryCourseAnswer.setAttendenceClassesPercentage(
        getInquiryRegistry().getAttendenceClassesPercentage());

    inquiryCourseAnswer.setEntryGrade(
        InquiryGradesInterval.getInterval(getInquiryRegistry().getRegistration().getEntryGrade()));
    inquiryCourseAnswer.setExecutionCourse(getInquiryRegistry().getExecutionCourse());
    inquiryCourseAnswer.setExecutionDegreeStudent(
        getInquiryRegistry()
            .getRegistration()
            .getLastStudentCurricularPlan()
            .getDegreeCurricularPlan()
            .getMostRecentExecutionDegree());
    ExecutionDegree executionDegreeCourse =
        ExecutionDegree.getByDegreeCurricularPlanAndExecutionYear(
            getInquiryRegistry().getCurricularCourse().getDegreeCurricularPlan(),
            getInquiryRegistry().getExecutionPeriod().getExecutionYear());
    inquiryCourseAnswer.setExecutionDegreeCourse(executionDegreeCourse);
    inquiryCourseAnswer.setExecutionPeriod(getInquiryRegistry().getExecutionPeriod());

    inquiryCourseAnswer.setNumberOfEnrolments(
        InquiryCourseAnswer.getNumberOfEnrolments(getInquiryRegistry()));
    inquiryCourseAnswer.setResponseDateTime(endTime);
    inquiryCourseAnswer.setRegistrationProtocol(
        getInquiryRegistry().getRegistration().getRegistrationProtocol());
    inquiryCourseAnswer.setStudyDaysSpentInExamsSeason(
        getInquiryRegistry().getStudyDaysSpentInExamsSeason());
    for (Shift enrolledShift :
        getInquiryRegistry()
            .getRegistration()
            .getShiftsFor(getInquiryRegistry().getExecutionCourse())) {
      inquiryCourseAnswer.addEnrolledShifts(enrolledShift);
    }
    final StudentInquiryExecutionPeriod studentInquiryExecutionPeriod =
        getInquiryRegistry()
            .getRegistration()
            .getStudent()
            .getStudentInquiryExecutionPeriod(getInquiryRegistry().getExecutionPeriod());
    inquiryCourseAnswer.setWeeklyHoursSpentInAutonomousWork(
        studentInquiryExecutionPeriod.getWeeklyHoursSpentInClassesSeason());
    inquiryCourseAnswer.setWeeklyHoursSpentPercentage(
        getInquiryRegistry().getWeeklyHoursSpentPercentage());

    inquiryCourseAnswer.setCommittedFraud(
        Boolean.FALSE); // TODO actualmente não existe registo desta info no fenix
    inquiryCourseAnswer.setGrade(getInquiryRegistry().getLastGradeInterval());
    for (InquiryBlockDTO inquiryBlockDTO : getCurricularCourseBlocks()) {
      for (InquiryGroupQuestionBean groupQuestionBean : inquiryBlockDTO.getInquiryGroups()) {
        for (InquiryQuestionDTO questionDTO : groupQuestionBean.getInquiryQuestions()) {
          if (!StringUtils.isEmpty(questionDTO.getResponseValue())) {
            QuestionAnswer questionAnswer =
                new QuestionAnswer(
                    inquiryCourseAnswer,
                    questionDTO.getInquiryQuestion(),
                    questionDTO.getFinalValue());
          }
        }
      }
    }

    for (AffiliatedTeacherDTO teacherDTO : getTeachersInquiries().keySet()) {
      for (StudentTeacherInquiryBean teacherInquiryBean : getTeachersInquiries().get(teacherDTO)) {
        if (teacherInquiryBean.isFilled() && teacherInquiryBean.isInquiryFilledIn()) {
          InquiryStudentTeacherAnswer inquiryTeacherAnswer = new InquiryStudentTeacherAnswer();

          inquiryTeacherAnswer.setProfessorship(
              teacherInquiryBean.getExecutionCourse().getProfessorship(teacherDTO.getTeacher()));

          inquiryTeacherAnswer.setShiftType(teacherInquiryBean.getShiftType());
          inquiryTeacherAnswer.setInquiryCourseAnswer(inquiryCourseAnswer);
          for (InquiryBlockDTO inquiryBlockDTO : teacherInquiryBean.getTeacherInquiryBlocks()) {
            for (InquiryGroupQuestionBean groupQuestionBean : inquiryBlockDTO.getInquiryGroups()) {
              for (InquiryQuestionDTO questionDTO : groupQuestionBean.getInquiryQuestions()) {
                QuestionAnswer questionAnswer =
                    new QuestionAnswer(
                        inquiryTeacherAnswer,
                        questionDTO.getInquiryQuestion(),
                        questionDTO.getFinalValue());
              }
            }
          }
        }
      }
    }
    getInquiryRegistry().setState(InquiriesRegistryState.ANSWERED);
  }