-
Notifications
You must be signed in to change notification settings - Fork 0
[TSK-71] 기존 기필 카테고리 대체과목 보정 로직 수정하여 동일과목 학점 미인정 이슈 해결 #310
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
base: main
Are you sure you want to change the base?
Changes from 6 commits
f8a2644
3059cc8
014d591
d496bf2
bb9bd4a
4e272f1
62267b3
531505f
76eb9ab
de8ae84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package kr.allcll.backend.domain.graduation.credit; | ||
|
|
||
| import jakarta.persistence.Column; | ||
| import jakarta.persistence.Entity; | ||
| import jakarta.persistence.GeneratedValue; | ||
| import jakarta.persistence.GenerationType; | ||
| import jakarta.persistence.Id; | ||
| import jakarta.persistence.Table; | ||
| import kr.allcll.backend.support.entity.BaseEntity; | ||
| import lombok.AccessLevel; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Table(name = "course_equivalences") | ||
| @Entity | ||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class CourseEquivalence extends BaseEntity { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
| @Column(name = "group_code", nullable = false) | ||
| private String groupCode; // 동일과목 그룹 번호 | ||
|
|
||
| @Column(name = "curi_no", nullable = false) | ||
| private String curiNo; // 학수번호 | ||
|
|
||
| @Column(name = "curi_nm", nullable = false, length = 255) | ||
| private String curiNm; // 과목명 | ||
|
|
||
| public CourseEquivalence(String groupCode, String curiNo, String curiNm) { | ||
| this.groupCode = groupCode; | ||
| this.curiNo = curiNo; | ||
| this.curiNm = curiNm; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package kr.allcll.backend.domain.graduation.credit; | ||
|
|
||
| import java.util.Optional; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
| import org.springframework.data.jpa.repository.Query; | ||
|
|
||
| public interface CourseEquivalenceRepository extends JpaRepository<CourseEquivalence, Long> { | ||
|
|
||
| @Query(""" | ||
| select e.groupCode from CourseEquivalence e | ||
| where e.curiNo = :curiNo | ||
| """) | ||
| Optional<String> findGroupCodeByCuriNo(String curiNo); | ||
|
Comment on lines
+19
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,27 @@ public class RequiredCourseResolver { | |
| private static final String WILD_CARD_DEPT_NM = "ALL"; | ||
| private final RequiredCourseRepository requiredCourseRepository; | ||
|
|
||
| public boolean findRequiredCourseInGroup( | ||
| String departmentName, | ||
| Integer admissionYear, | ||
| CategoryType categoryType, | ||
| String groupCode | ||
| ) { | ||
| List<RequiredCourse> requiredCourseCandidatesWithWildCard = | ||
| requiredCourseRepository.findRequiredCoursesByGroupCode( | ||
| List.of(WILD_CARD_DEPT_NM, departmentName), | ||
| admissionYear, | ||
| categoryType, | ||
| groupCode | ||
| ); | ||
|
Comment on lines
+27
to
+32
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 저희 요거 WILD_CARD인데 FALSE면 제외해줘야하지 않나요...???? wild card면 대상인 것으로 조회하는 것 같은데 맞을까요?!
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 넵! 맞습니다! 우선, 결론부터 말씀드리면 와일드카드 및 사용자 학과로 기준 데이터를 모두 조회한 뒤, 위 메서드에서 해당 쿼리가 실행되는데, 쿼리에서 제외하지 않은 이유는 예전에 혹시 추가적으로 왜 와일드카드와 학과를 모두 조회하고 |
||
|
|
||
| List<RequiredCourse> requiredCoursesWithStatus | ||
| = getDepartmentRequiredCourses(requiredCourseCandidatesWithWildCard, departmentName); | ||
|
|
||
| return requiredCoursesWithStatus.stream() | ||
| .anyMatch(RequiredCourse::getRequired); | ||
| } | ||
|
|
||
| public List<String> findRequiredCourseNames( | ||
| String departmentName, | ||
| Integer admissionYear, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package kr.allcll.backend.support.sheet.validation; | ||
|
|
||
| import java.util.List; | ||
| import kr.allcll.backend.support.sheet.GraduationSheetTable; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| @Component | ||
| @RequiredArgsConstructor | ||
| public class CourseEquivalencesSheetValidator implements GraduationSheetValidator { | ||
|
|
||
| public static final String TAB_KEY = "course-equivalences"; | ||
|
|
||
| private static final List<String> REQUIRED_HEADERS = List.of( | ||
| "group_code", | ||
| "curi_no", | ||
| "curi_nm" | ||
| ); | ||
|
|
||
| private final GraduationSheetValidationSupport graduationSheetValidationSupport; | ||
|
|
||
| @Override | ||
| public String tabKey() { | ||
| return TAB_KEY; | ||
| } | ||
|
|
||
| @Override | ||
| public void validate(GraduationSheetTable sheetTable) { | ||
| graduationSheetValidationSupport.validateNotEmpty(TAB_KEY, sheetTable); | ||
| graduationSheetValidationSupport.validateRequiredHeaders(TAB_KEY, sheetTable, REQUIRED_HEADERS); | ||
|
|
||
| List<List<Object>> dataRows = sheetTable.getDataRows(); | ||
| for (int rowIndex = 0; rowIndex < dataRows.size(); rowIndex++) { | ||
| List<Object> dataRow = dataRows.get(rowIndex); | ||
|
|
||
| graduationSheetValidationSupport.requireString(TAB_KEY, sheetTable, dataRow, rowIndex, "group_code"); | ||
| graduationSheetValidationSupport.requireString(TAB_KEY, sheetTable, dataRow, rowIndex, "curi_no"); | ||
| graduationSheetValidationSupport.requireString(TAB_KEY, sheetTable, dataRow, rowIndex, "curi_nm"); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sync now persists
group_codeand the newfindRequiredCourseInGrouplogic depends on it, butrequired-coursesvalidation still does not require that column/value; if the sheet is not updated (or cells are blank), rows are saved withnullgroup codes and group-based matching always misses, causing equivalent/replacement academic-basic courses to be incorrectly treated as not required instead of failing fast during sync.Useful? React with 👍 / 👎.