Skip to content

Commit

Permalink
fix: department 조회 로직 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Soundbar91 committed Dec 29, 2024
1 parent 2a1c9f6 commit 862775f
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
import in.koreatech.koin.domain.graduation.model.Catalog;
import in.koreatech.koin.domain.graduation.model.CourseType;
import in.koreatech.koin.domain.graduation.repository.CatalogRepository;
import in.koreatech.koin.domain.student.model.Department;
import in.koreatech.koin.domain.student.model.Student;
import in.koreatech.koin.domain.student.repository.DepartmentRepository;
import in.koreatech.koin.domain.student.repository.StudentRepository;
import in.koreatech.koin.domain.student.util.StudentUtil;
import in.koreatech.koin.domain.timetable.model.Lecture;
Expand All @@ -27,7 +25,6 @@ public class TimetableLectureCreator {
private final LectureRepositoryV2 lectureRepositoryV2;
private final TimetableLectureRepositoryV2 timetableLectureRepositoryV2;
private final CatalogRepository catalogRepository;
private final DepartmentRepository departmentRepository;
private final StudentRepository studentRepository;

public void createTimetableLectures(TimetableLectureCreateRequest request, Integer userId, TimetableFrame frame) {
Expand All @@ -50,9 +47,8 @@ private CourseType determineCourseType(Lecture lecture, Integer userId) {
private CourseType getCourseType(Integer userId, Lecture lecture) {
Student student = studentRepository.getById(userId);
String year = StudentUtil.parseStudentNumberYear(student.getStudentNumber()).toString();
Department department = departmentRepository.getByName(student.getDepartment().getName());
String code = lecture.getCode();
Catalog catalog = catalogRepository.getByYearAndDepartmentAndCode(year, department, code);
Catalog catalog = catalogRepository.getByYearAndDepartmentAndCode(year, student.getDepartment(), code);
return catalog.getCourseType();
}

Expand Down

0 comments on commit 862775f

Please sign in to comment.