Teacher teacher = degreeTeachingService.getProfessorship().getTeacher(); Category teacherCategory = teacher.getCategory(executionPeriod.getBeginDateYearMonthDay(), executionPeriod.getEndDateYearMonthDay());
Teacher teacher = degreeTeachingService.getProfessorship().getTeacher(); Category teacherCategory = teacher.getCategoryForCreditsByPeriod(executionPeriod);
    public Double getTeachingDegreeCredits() {        double credits = 0;        ExecutionYear executionYear20062007 = ExecutionYear.readExecutionYearByName("2006/2007");        for (DegreeTeachingService degreeTeachingService : getDegreeTeachingServices()) {            ExecutionCourse executionCourse = degreeTeachingService.getProfessorship().getExecutionCourse();            ExecutionPeriod executionPeriod = executionCourse.getExecutionPeriod();            if (!executionCourse.isMasterDegreeOnly() && (executionPeriod.getExecutionYear().isBefore(executionYear20062007) ||                    !executionCourse.areAllOptionalCurricularCoursesWithLessTenEnrolments())) {                                Teacher teacher = degreeTeachingService.getProfessorship().getTeacher();                Category teacherCategory = teacher.getCategory(executionPeriod.getBeginDateYearMonthDay(), executionPeriod.getEndDateYearMonthDay());                if (teacherCategory != null                         && teacherCategory.getCode().equals("AST") && teacherCategory.getLongName().equals("ASSISTENTE")                        && degreeTeachingService.getShift().getTipo().equals(ShiftType.TEORICA)) {                                        double hours = degreeTeachingService.getShift().hours();                    credits += (hours * (degreeTeachingService.getPercentage().doubleValue() / 100)) * 1.5;                                    } else {                                        double hoursAfter20PM = degreeTeachingService.getShift().hoursAfter(20);                    double hoursBefore20PM = degreeTeachingService.getShift().hours() - hoursAfter20PM;                    credits += hoursBefore20PM * (degreeTeachingService.getPercentage().doubleValue() / 100);                    credits += (hoursAfter20PM * (degreeTeachingService.getPercentage().doubleValue() / 100)) * 1.5;                }                            }        }        return round(credits);    }