-
Notifications
You must be signed in to change notification settings - Fork 0
hotfix: 쿼리 수정 #236
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
hotfix: 쿼리 수정 #236
Conversation
Co-authored-by: 나용준 <141994188+youngJun99@users.noreply.github.com>
Summary of ChangesHello @yongjun0511, 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! 이 핫픽스는 날짜 기반 필터를 제거하여 파트너십 정보 검색 로직을 조정합니다. 이 수정으로 파트너십 데이터가 지난 7일 이내에 시작된 항목으로 제한되지 않아, 활성 파트너십에 대한 보다 포괄적인 보기를 제공합니다. Highlights
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은 제휴(Partnership) 정보를 가져오는 쿼리에서 시작 날짜(startDate)에 대한 7일 제한 조건을 제거하는 수정을 포함하고 있습니다. 이를 통해 시작일에 관계없이 현재 유효한 모든 제휴 정보를 조회하도록 변경되었습니다. 코드 변경 자체는 의도에 부합하는 것으로 보입니다. 다만, 리뷰 결과 Partnership 엔티티에 적용된 @Where 절로 인해 JPQL 쿼리 내에 중복된 필터링 조건이 존재하는 것을 발견했습니다. 이 중복 로직은 코드의 가독성과 유지보수성을 저해할 수 있으므로, 관련 피드백을 통해 수정을 제안했습니다. 해당 부분을 정리하면 코드가 더 명확해질 것입니다.
| or (pc is null and pd is null) | ||
| ) | ||
| and p.startDate >= current_date - 7 | ||
| and (p.endDate is null or p.endDate >= current_date) |
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.
Partnership 엔티티에 @Where(clause = "start_date <= CURRENT_DATE AND end_date >= CURRENT_DATE") 어노테이션이 이미 적용되어 있어, 현재 활성화된 제휴만 필터링하고 있습니다. 따라서 이 JPQL 쿼리에서 (p.endDate is null or p.endDate >= current_date) 조건을 추가하는 것은 중복입니다. 또한, Partnership 엔티티의 endDate 필드는 @Column(nullable = false)로 정의되어 있어 p.endDate is null 조건은 항상 거짓이 됩니다. 코드의 명확성과 유지보수성을 위해 이 중복 조건을 제거하고 @Where 절에 필터링 로직을 일원화하는 것을 권장합니다.
| LEFT JOIN FETCH p.partnershipCollege | ||
| LEFT JOIN FETCH p.partnershipDepartment | ||
| WHERE p.startDate >= current_date - 7 and (p.endDate is null or p.endDate >= CURRENT_DATE)""") | ||
| WHERE p.endDate is null or p.endDate >= CURRENT_DATE""") |
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.
Partnership 엔티티에 @Where(clause = "start_date <= CURRENT_DATE AND end_date >= CURRENT_DATE") 어노테이션이 적용되어 있어, 이 JPQL 쿼리의 WHERE 절은 중복된 로직을 포함하고 있습니다. @Where 절이 이미 활성화된 제휴(partnership)만 가져오도록 필터링하므로, 이 WHERE 조건은 불필요합니다. 또한 Partnership의 endDate 필드는 @Column(nullable = false)로 선언되어 있어 p.endDate is null 조건은 항상 거짓이므로 혼란을 줄 수 있습니다. 필터링 로직을 @Where 절로 일원화하여 코드의 일관성을 높이고 중복을 제거하는 것을 제안합니다.
| WHERE p.endDate is null or p.endDate >= CURRENT_DATE""") | |
| """) |
No description provided.