-
Notifications
You must be signed in to change notification settings - Fork 0
[TSK-56-147] 고전독서인증 진행도 계산 시 기준 초과 도서 제외 #299
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
Changes from all commits
bada53c
9f57c1f
fdd6394
170fd15
77935c4
ddfa0f5
78e741d
d668567
74a542d
ed5aec4
93c602e
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,35 @@ | ||
| package kr.allcll.backend.domain.graduation.check.cert; | ||
|
|
||
| import lombok.Getter; | ||
| import lombok.RequiredArgsConstructor; | ||
|
|
||
| import java.util.Arrays; | ||
| import java.util.Optional; | ||
|
|
||
| @Getter | ||
| @RequiredArgsConstructor | ||
| public enum ClassicsArea { | ||
| WESTERN("서양의 역사와 사상", 4), | ||
| EASTERN("동양의 역사와 사상", 2), | ||
| EASTERN_AND_WESTERN("동·서양의 문학", 3), | ||
| SCIENCE("과학 사상", 1); | ||
|
Comment on lines
+12
to
+15
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.
Avoid hard-coding per-area caps here, because this commit now truncates fetched counts to Useful? React with 👍 / 👎. |
||
|
|
||
| private final String koreanName; | ||
| private final int maxRecognizedCount; | ||
|
|
||
| public static Optional<ClassicsArea> findByLabel(String label) { | ||
| return Arrays.stream(values()) | ||
| .filter(area -> label.contains(area.koreanName)) | ||
| .findFirst(); | ||
| } | ||
|
|
||
| public static int getTotalRequiredCount() { | ||
| return Arrays.stream(values()) | ||
| .mapToInt(ClassicsArea::getMaxRecognizedCount) | ||
| .sum(); | ||
| } | ||
|
|
||
| public int getRecognizedCount(int actualCount) { | ||
| return Math.min(actualCount, maxRecognizedCount); | ||
| } | ||
| } | ||
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.
아래 사진에서 사용되는 부분이 해당 졸업인증 기준 데이터 조회 API 응답의 고전독서 부분에서 가져오는 걸로 알고 있는데요!
따라서, 고전독서 기준데이터를 내려주는 건 필요하다고 생각합니다!
기존 DB에서 가져와서 응답을 만드는 로직에서 ENUM 활용 로직으로 충분히 내려줄 수 있지 안을까용? 어떻게 생각하시는지 궁금합니다!
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.
헉 왜 response 필드도 지웠지
꼼꼼히 확인해주셔서 감사합니다!! 한번 더 물어보길 잘햇다