-
Notifications
You must be signed in to change notification settings - Fork 1
refactor(club-meeting): 도메인 책임을 객체로 이동 #293
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
Draft
MODUGGAGI
wants to merge
11
commits into
develop
Choose a base branch
from
refactor/292/club-meeting-domain-refactor
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ce5f2e3
test(club-meeting): 팀 편성의 기존 동작을 고정
MODUGGAGI ef99886
refactor(club-meeting): 팀원 교체 책임을 Team에 위임
MODUGGAGI 5423355
refactor(club-meeting): 팀 재구성 책임을 Meeting에 위임
MODUGGAGI 41d6423
refactor(club-meeting): Meeting 팀 편성 캡슐화를 강화
MODUGGAGI bf4804d
perf(club-meeting): 팀 자식 컬렉션 조회를 배치 최적화
MODUGGAGI adcf9f6
test(club-meeting): 한줄평과 별점 합계 동작을 고정
MODUGGAGI 2af627e
refactor(club-meeting): 한줄평과 별점 합계 책임을 Meeting에 위임
MODUGGAGI d91b298
test(club-meeting): 콘텐츠 권한과 오류 우선순위를 고정
MODUGGAGI 1bcc3d6
refactor(club-meeting): 콘텐츠 권한을 도메인 명령으로 이동
MODUGGAGI fdd3e2c
test(club-meeting): 도메인 리팩토링 HTTP 회귀를 고정
MODUGGAGI b8aba46
fix(club-meeting): fallback 재계산 시 별점 합계 정합성을 보장
MODUGGAGI File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/main/java/checkmo/clubMeeting/internal/entity/ClubMeetingActor.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| package checkmo.clubMeeting.internal.entity; | ||
|
|
||
| public record ClubMeetingActor(Long clubMemberId, boolean staff) { | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🐛 버그 리포트: 별점 수정 시 합계 재계산 로직의 왜곡 발생
Meeting.reviseBookReview메서드에서review.updateBookReview(description, newRate)를 호출하여BookReview객체의 별점(rate)을 먼저 변경한 뒤,subtractSumRate(oldRate)를 호출하고 있습니다.이때, 만약
subtractSumRate내부에서this.sumRate < rate조건이 참이 되어 별점 합계 재계산(this.bookReviews.stream().mapToDouble(BookReview::getRate).sum())이 수행되면 심각한 버그가 발생합니다.🔍 원인 분석
review.updateBookReview가 이미 호출되었으므로,this.bookReviews목록에 있는 해당 리뷰의 별점은 이미 **새로운 별점(newRate)**으로 반영되어 있습니다.sumRate는 이미newRate를 포함하고 있으며,oldRate는 포함하고 있지 않습니다.subtractSumRate는 재계산된 값에서 다시oldRate를 차감하고, 이후reviseBookReview에서addSumRate(newRate)를 호출하여newRate를 한 번 더 더하게 됩니다.sumRate는(다른 리뷰들의 합 + newRate) - oldRate + newRate가 되어, 실제 별점 합계보다newRate - oldRate만큼 왜곡된 잘못된 값이 저장됩니다.🛠️ 해결 방안
subtractSumRate(oldRate)를 호출하여 기존 별점을 먼저 차감한 이후에review.updateBookReview를 호출하고, 마지막으로addSumRate(newRate)를 호출하도록 순서를 변경해야 합니다.