-
Notifications
You must be signed in to change notification settings - Fork 0
fix: 마이페이지 rating Primitive형 수정 #327
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
The head ref may contain hidden characters: "fix/#324-\uB9C8\uC774\uD398\uC774\uC9C0_rating"
Conversation
Summary of ChangesHello @JjungminLee, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 마이페이지에서 사용자 리뷰의 평점이 Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. 널 값은 사라지고, 평점은 빛을 찾네. 마이페이지에, 정확한 숫자가, 이제는 반짝이리. Footnotes
|
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.
Code Review
안녕하세요. PR을 잘 확인했습니다. 마이페이지에서 rating이 null로 표시되는 문제를 해결하기 위해 MyMealReviewResponse DTO의 로직을 수정한 것을 확인했습니다. 변경된 로직은 ratings 객체와 레거시 rating 필드를 모두 고려하여 올바르게 평점을 계산하도록 수정되었습니다. 이는 버그를 해결하는 좋은 접근 방식입니다. 코드 품질을 더욱 향상시키기 위해 몇 가지 제안 사항을 남깁니다. Optional을 사용하여 코드를 더 간결하게 만들고, 중복되는 JPA 어노테이션을 제거하는 것을 고려해 보세요. 자세한 내용은 각 파일의 주석을 참고해 주세요.
| @AttributeOverrides({ | ||
| @AttributeOverride(name = "mainRating", column = @Column(name = "main_rating")), | ||
| @AttributeOverride(name = "amountRating", column = @Column(name = "amount_rating")), | ||
| @AttributeOverride(name = "tasteRating", column = @Column(name = "taste_rating")) | ||
| }) |
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.
| Ratings ratings = review.getRatings(); | ||
| int rating = 0; | ||
| Integer rating = review.getRating(); | ||
|
|
||
| if (ratings != null) { | ||
| rating = ratings.getMainRating() != null ? ratings.getMainRating() : 0; | ||
| rating = ratings.getMainRating() != null ? ratings.getMainRating() : rating; | ||
| } |
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.
현재 로직은 올바르게 동작하지만, Optional을 사용하면 코드를 더 간결하고 가독성 높게 개선할 수 있습니다. Optional을 사용하면 null 체크를 명시적으로 하지 않고도 'ratings에서 mainRating을 가져오되, 없으면 기존 rating 값을 사용한다'는 의도를 명확하게 표현할 수 있습니다. 아래와 같이 수정하는 것을 제안합니다. (java.util.Optional 임포트가 필요할 수 있습니다.)
| Ratings ratings = review.getRatings(); | |
| int rating = 0; | |
| Integer rating = review.getRating(); | |
| if (ratings != null) { | |
| rating = ratings.getMainRating() != null ? ratings.getMainRating() : 0; | |
| rating = ratings.getMainRating() != null ? ratings.getMainRating() : rating; | |
| } | |
| Integer rating = java.util.Optional.ofNullable(review.getRatings()) | |
| .map(Ratings::getMainRating) | |
| .orElse(review.getRating()); |
#️⃣ Issue Number
📝 요약(Summary)
💬 공유사항 to 리뷰어
✅ PR Checklist
PR이 다음 요구 사항을 충족하는지 확인하세요.