Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 이수 구분 테이블 general_education_area_id 추가 #1239

Conversation

Soundbar91
Copy link
Contributor

🔥 연관 이슈

🚀 작업 내용

  • 이수 구분 테이블에 general_education_area_id를 추가했습니다.
  • timetableLecture 생성 시 이수구분 생성되는 로직을 변경했습니다.

💬 리뷰 중점사항

@Soundbar91 Soundbar91 added the Team User 유저 팀에서 작업할 이슈입니다 label Feb 13, 2025
@Soundbar91 Soundbar91 self-assigned this Feb 13, 2025
@github-actions github-actions bot added the 기능 새로운 기능을 개발합니다. label Feb 13, 2025
Copy link
Contributor

@duehee duehee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

간단한 거 하나만 확인해주세요~
고생하셨습니당 :D

}
}

return null;
return courseTypeRepository.getByName("이수구분선택");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A

오.. 세심하셔라

@@ -7,6 +7,7 @@
import org.springframework.web.bind.annotation.RequestParam;

import in.koreatech.koin.domain.timetableV3.dto.response.LectureResponseV3;
import in.koreatech.koin.global.auth.UserId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C

이거 추가 된 이유가 있나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

학기 강의 개설 목록 구현할 때, 조회되는 강의의 이수구분을 유저의 기준으로 할려고 했습니다.
그래서 userId를 가져오기 위해서 어노테이션을 사용했다가, 지우는 과정에서 못 지웠네요,,
감사합니답

@Soundbar91 Soundbar91 merged commit 1c37a08 into feature/1140-graduation-credit-calculator Feb 13, 2025
2 checks passed
@Soundbar91 Soundbar91 deleted the feature/lecture-add-course-type branch February 13, 2025 09:42
Copy link
Contributor

@seongjae6751 seongjae6751 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생 많으셨습니다!
간단한거 몇가지만 확인하고 머지해주세요!

Comment on lines -49 to 75
if (lecture == null) {
return null;
}
private CourseType getCourseType(Lecture lecture, Integer userId) {
Student student = studentRepository.getById(userId);
if (Objects.isNull(student.getDepartment())) {
return null;
Integer studentNumberYear = StudentUtil.parseStudentNumberYear(student.getStudentNumber());

List<Catalog> catalogs = catalogRepository.findByLectureNameAndYear(lecture.getName(),
String.valueOf(studentNumberYear));
if (!catalogs.isEmpty()) {
return catalogs.get(0).getCourseType();
}
String code = lecture.getCode();
Catalog catalog = catalogRepository.getByDepartmentAndCode(student.getDepartment(), code);
if (Objects.isNull(catalog)) {
return null;

final int currentYear = LocalDateTime.now().getYear();
for (int initStudentNumberYear = 2019; initStudentNumberYear <= currentYear; initStudentNumberYear++) {
catalogs = catalogRepository.findByYearAndCode(String.valueOf(initStudentNumberYear),
lecture.getCode());

if (!Objects.isNull(catalogs)) {
return catalogs.get(0).getCourseType();
}
}
return catalog.getCourseType();

return courseTypeRepository.getByName("이수구분선택");
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C

private CourseType getCourseType(Lecture lecture, Integer userId) {
    Student student = studentRepository.getById(userId);
    Integer studentNumberYear = StudentUtil.parseStudentNumberYear(student.getStudentNumber());

    return catalogRepository.findByLectureNameAndYear(lecture.getName(), String.valueOf(studentNumberYear))
        .stream()
        .findFirst()
        .map(Catalog::getCourseType)
        .orElseGet(() -> findCourseTypeByYearAndCode(lecture));
}

private CourseType findCourseTypeByYearAndCode(Lecture lecture) {
    final int currentYear = LocalDateTime.now().getYear();
    for (int initStudentNumberYear = 2019; initStudentNumberYear <= currentYear; initStudentNumberYear++) {
        Optional<CourseType> courseType = catalogRepository.findByYearAndCode(
            String.valueOf(initStudentNumberYear), lecture.getCode())
            .stream()
            .findFirst()
            .map(Catalog::getCourseType);

        if (courseType.isPresent()) {
            return courseType.get();
        }
    }
    return courseTypeRepository.getByName("이수구분선택");
}

이런식으로 stream을 사용해서 조금 더 깔끔하게 쓸 수 있을 것 같아요~

Comment on lines +70 to +79
for (int initStudentNumberYear = 2019; initStudentNumberYear <= currentYear; initStudentNumberYear++) {
catalogs = catalogRepository.findByYearAndCode(String.valueOf(initStudentNumberYear),
lecture.getCode());

if (!Objects.isNull(catalogs)) {
return catalogs.get(0).getCourseType();
}
}

return null;
return courseTypeRepository.getByName("이수구분선택");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R

for (int initStudentNumberYear = 2019; initStudentNumberYear <= currentYear; initStudentNumberYear++) {
    catalogs = catalogRepository.findByYearAndCode(String.valueOf(initStudentNumberYear), lecture.getCode());

    if (!catalogs.isEmpty()) {
        return catalogs.get(0).getCourseType();
    }
}

findByYearAndCode()가 빈 리스트를 반환한다면 null 체크가 불필요해서 isEmpty를 검사하는게 좀 더 맞을 것 같아요!

if (Objects.equals(catalog.getDepartment(), department)) {
return catalog.getCourseType();
final int currentYear = LocalDateTime.now().getYear();
for (int initStudentNumberYear = 2019; initStudentNumberYear <= currentYear; initStudentNumberYear++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C
2019는 상수 처리 해도 좋을 것 같네요!

}
}

return null;
return courseTypeRepository.getByName("이수구분선택");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C
이수구분선택도 상수 처리 할 수 있을 것 같네요..!

private static final String DEFAULT_COURSE_TYPE = "이수구분선택";

...

return courseTypeRepository.getByName(DEFAULT_COURSE_TYPE);

seongjae6751 added a commit that referenced this pull request Feb 15, 2025
* feat: 졸업학점 계산기 초기 설정

* feat: flyway추가 & model 관련 추가 및 수정

* feat: 시간표 조회 API 이수 구분 반환 추가 (#1150)

* feat: repository 추가

* feat: exception 추가

* feat: 이수 구분 반환값 추가

* feat: coursetype 반환값 추가

* test: 테스트 코드 수정

* chore: 리뷰 반영

* fix: department 중복 수정

* fix: department 조회 로직 변경

* feat : 엑셀 파일로 과거 시간표 추가하기 (#1153)

* feat : 엑셀 파일 최신화

* feat : 리팩토링 진행 및 패키지 이동

* chore : 안 쓰는 import 제거 및 정리

* chore : 관규님 리뷰 반영

* chore : 개행 추가

* feat: lecture 컬럼 크기 수정 flyway 추가 (#1142)

* fix: 식단 이미지 알림 롤백  (#1145)

* fix: 스케줄러 cron식 수정

* fix: 식단 이미지 업로드 알림 롤백

* fix : 동계방학 생협 운영시간 업데이트 (#1144)

* fix : 생협 동계학기 운영 시간 수정

* fix : 생협 동계학기 운영 시간 수정

* chore : 공백 추가

* fix: 세탁소 전화번호 수정

* feat: 스웨거 그룹화 (#1138)

* chore: swagger 패키지 생성 및 클래스 이동

* feat: 비즈니스팀 API 그룹화

* chore: 비즈니스 API 추가

* feat: 캠퍼스팀 API 그룹화

* feat: 유저팀 API 그룹화

* feat: ABTEST API 그룹화

* feat: BCSD API 그룹화

* chore: 비즈니스팀 API 추가

* feat: 어드민 API 그룹화

* chore: 유저팀 API 추가

* feat: 로그인 API 그룹화 및 그룹 이름 변경

* refactor: 패키지 경로 enum화

* refactor: 중복 코드 메소드화

* refactor: 그룹 스웨거 파일 분할

* chore: 미사용 import 삭제

* chore: 메소드 명 변경

* chore: 리뷰 반영

* fix: 안경점, 우편취급국 운영시간 추가, 대즐 운영시간 오타 수정 (#1151)

* feat: flyway추가 & model 관련 추가 및 수정

* feat: 시간표 조회 API 이수 구분 반환 추가 (#1150)

* feat: repository 추가

* feat: exception 추가

* feat: 이수 구분 반환값 추가

* feat: coursetype 반환값 추가

* test: 테스트 코드 수정

* chore: 리뷰 반영

* fix: department 중복 수정

* fix: department 조회 로직 변경

* rebase : 충돌 해결

* chore : 현수님 리뷰 반영

---------

Co-authored-by: 신관규 <[email protected]>
Co-authored-by: 허준기 <[email protected]>
Co-authored-by: Hwang HyeonSik <[email protected]>
Co-authored-by: 김원경 <[email protected]>

* feat: 졸업학점 계산 동의 API 및 학과, 시간표 수정 대응 (#1154)

* feat: Repository추가

* feat: TimetableLecture CourseType 추가

* feat: 학번 혹은 학과 수정시 졸업요건 정보 업데이트

* feat: 졸업학점 계산 동의 api

* feat: 시간표 변경 감지

* feat: 졸업학점 계산 동의 로직 수정

* feat: 학과 수정 로직 수정

* fix: 리뷰 반영

* feat: 졸업학점 자신이 들은 학점 보여주는 기능 구현 (#1155)

* feat: 기능 구현

* chore: 리뷰 반영

* chore: 리뷰 반영

* chore: 리뷰 반영

* chore: 변경 여부에 따른 처리 로직 추가

* feat: 코드 충돌 해결

* fix: 테스트 에러 해결

---------

Co-authored-by: 김원경 <[email protected]>
Co-authored-by: 김성재 <[email protected]>

* test: 테스트 코드 수정

* test: 테스트 코드 수정

* feat: timetable v3 졸업학점계산기 로직 추가 (#1179)

* chore: flyway 최신화

* feat: v2 이수구분 수정 추가

* fix: 이수구분 반환 로직 수정

* fix: 이수 구분 수정 롤백

* fix: 학과공통 추가

* fix: year 삭제

* fix: year 삭제

* fix: year 삭제

* chore: 커스텀 강의 이수구분 반환 추가

* fix: year 삭제, 로직 수정

* feat: v3 졸학계 로직 추가

* chore: v3 졸학계 로직 수정

* chore: timetable v1 졸학계 로직 추가

* chore: 리뷰반영

* feat : 학기와 이수구분으로 강의 찾기 (#1184)

* fix : flyway 116번, 117번 수정

* feat : Repository 정리 및 작성

* feat : Response 추가

* feat : exception 추가

* chore : Repo 정리

* feat : Service 및 Controller 작성

* feat : graduation 도메인 swagger 추가

* feat : 리뷰 반영

* chore : 리뷰 반영

* Feat: major 요소 추가 및 로직수정 (#1192)

* feature: major 관련 sql문 추가

* feat: model 관련 로직 추가

* refactor: department_id -> major_id로 변경

* refactor: 졸학계 department -> major 관련 로직으로 수정

* chore: 조회 요건에서 year 제거

* fix: catalog에 department_id대신 major_id 변경

* fix: 오류 수정

---------

Co-authored-by: 김원경 <[email protected]>
Co-authored-by: seongjae6751 <[email protected]>

* fix: catalog에 department_id 추가(누락 실수 추가)

* feat: 교양 영역 테이블 추가 (#1205)

* feat: 이수 구분 수정 기능 추가

* feat: 교양 영역 엔티티 추가

* feat: Catalog - GeneralEducationArea 연관관계 설정

* feat: Catalog - Department 연관관계 설정

* chore: 리뷰 반영

* fix: 졸업학점 계산기 관련 flyway 수정 (#1209)

* feat: course_type 테이블 year 컬럼 추가

* feat: timetable_lecture 테이블에 general_education_area id 추가

* fix: catalog 테이블에서 general_education_area_id 삭제

* feat: general_education_area - course_type 매핑 테이블 추가

* fix: dto 내부 함수 변경

* fix: flyway 오류 수정

* fix: 연관관계 어노테이션 수정

* Revert "feat: course_type 테이블 year 컬럼 추가"

This reverts commit 95e4ded.

* feat: courseType 생성자 수정

* feat: 리뷰 반영

* feat : 학부/전공 전체 조회(졸학계) (#1220)

* feat : 학부/전공 전체 조회 API 작성

* chore : api path 이름 변경

* chore : api path 변경(2)

* chore : 리뷰 반영

* refactor: 졸업 학점 계산 Catalog 테이블 학과 공통 처리 및 major 우선 로직 반영  (#1208)

* refactor: major 없을 시 department 기반으로 이수요건 조회 보완

* chore: 주석 제거

* fix: flyway 번호 변경

* fix: catalog 테이블 year 추가

* feat : 졸학계 엑셀파일 집어넣기 최신판(졸학계) (#1233)

* feat : 작업 중 브랜치 최신화

* chore : flyway 수정

* feat : 실수하지 않기 위한 커밋

* feat : 졸학계 엑셀 열심히 때려고치기

* feat : 플라이웨이 싹다 밀기

* rafactor & docs : 엑셀 관련 로직 설명 추가 및 리팩토링 (#1234)

* feat : Catalog 수정 및 조금의 리팩토링
docs : 간단한 설명 주석 추가

* chore : 나쁜 주석 지우기

* chore : checkSemester api 내의 user_id 반환값 삭제 (#1237)

* feat: 이수 구분 테이블 general_education_area_id 추가 (#1239)

* fix: timetableLecture 생성 시, 이수 구분 생성 로직 변경

* 임시 커밋

* fix: timetableLecture 생성 시 이수구분 로직 수정

* 임시 커밋

* feat: courseType 기본값 반환 추가

* 임시커밋

* fix: 115 flyway 수정

* feat: 교양 영역 id 추가

* fix: flyway 오타 수정

* fix: lecture 이수구분 반환값 롤백

* refactor: timetable V1 이수구분 로직 수정

* feat: 삭제된 내용 추가

* feat: repository 메소드 추가

* fix: 메소드 이름 변경

* chore: 미사용 어노테이션 삭제

* chore: 미사용 import문 삭제

* chore: 미사용 import문 삭제

* feat : 졸학계 엑셀 / 강의조회 로직 내 GeneralEducationArea 추가(졸학계) (#1240)

* feat : GeneralEducationArea 추가!!!

* feat : 교양 전체 조회 기능 추가

* chore : 리뷰 반영 및 api path 수정

* feat: timetableV3 aop 추가

* feat: timetable 교양영역 추가

* feat: timetable 교양영역 응답값 추가

* feat: timetable 교양영역 응답값 추가

* chore: 주석 제거 및 미사용 import 삭제

* fix: 매핑 테이블 삭제

* fix: timetable V1 졸학계 로직 삭제

* test: 테스트 1차 수정

* test: 테스트 2차 수정

* test: 테스트 3차 수정

* fix: 대학요람 조회 로직 수정

* test: 테스트 4차 수정

* test: 테스트 5차 수정

* chore: 에너지신소재공학부 이름 변경

* chore: 충돌 해결

* chore: 스웨거 누락 수정

---------

Co-authored-by: 원경 <[email protected]>
Co-authored-by: 김원경 <[email protected]>
Co-authored-by: 듀히 <[email protected]>
Co-authored-by: 허준기 <[email protected]>
Co-authored-by: Hwang HyeonSik <[email protected]>
Co-authored-by: 김원경 <[email protected]>
Co-authored-by: 김성재 <[email protected]>
Co-authored-by: seongjae6751 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team User 유저 팀에서 작업할 이슈입니다 기능 새로운 기능을 개발합니다.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants