-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 세션 생성 시 루트미션 추천 만들어지는 부분 구현 #49
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
Conversation
|
Claude finished @eric-jy-park's task —— View job 코드 리뷰 완료할 일 목록:
리뷰 요약세션 생성 시 루트미션 추천 기능이 구현되었습니다. 기본적인 구조는 잘 설계되었으나, 성능과 데이터 검증 측면에서 개선이 필요합니다. 특히
코드 리뷰RecommendationServiceImpl.java:37 - issue: RecommendationServiceImpl.java:42-44 - issue: N+1 쿼리 문제 - 각 루트미션마다 attempts를 별도 조회하여 성능 저하, fetch join 사용하여 한 번에 로드 필요 RecommendationServiceImpl.java:56 - issue: 하드코딩된 추천 개수 제한 - 30개로 고정되어 있어 유연성 부족, 설정값이나 파라미터로 변경 필요 RecommendationServiceImpl.java:72-74 - suggestion: 중복된 필터링 로직 - 이미 추천 생성 시 필터링했으나 조회 시 다시 필터링, 불필요한 연산 제거 고려 UserMissionAttemptRequest.java:10 - issue: 잘못된 validation 어노테이션 - Long 타입에 AttemptController.java:65 - issue: 빈 객체 반환 - 실제 구현 없이 빈 응답 객체만 반환, 임시 구현이라도 적절한 에러 메시지나 구현 예정 안내 필요 |
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.
Pull Request Overview
세션 생성 시 루트미션 추천 시스템을 구축하는 기능을 구현하였습니다. 사용자가 새로운 세션을 시작할 때 자동으로 해당 사용자에게 맞는 루트미션 추천을 생성합니다.
- 세션 생성 시점에 추천 로직이 자동으로 실행되도록 통합
- 사용자가 시도하지 않은 루트미션을 필터링하여 최대 30개 추천 생성
- 추천 데이터 조회를 위한 REST API 엔드포인트 구현
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| application.yaml | Hibernate DDL 설정을 create에서 update로 변경 |
| TestController.java | 테스트 데이터 생성에 섹터와 루트미션 데이터 추가 |
| UserSessionServiceImpl.java | 세션 생성 시 추천 서비스 호출 로직 추가 |
| RecommendationServiceImpl.java | 세션별 추천 생성 및 조회 로직 구현 |
| RecommendationController.java | 추천 조회 API 엔드포인트 구현 |
| Repository files | 섹터와 루트미션을 위한 기본 JPA 레포지토리 추가 |
| AttemptController.java | 도전 기록 생성 API 스켈레톤 추가 |
|
|
||
| @Data | ||
| public class UserMissionAttemptRequest { | ||
| @NotBlank |
Copilot
AI
Jul 31, 2025
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.
| }) | ||
| .toList(); | ||
|
|
||
| recommendations = recommendations.subList(0, (int) Math.min(30, (long) recommendations.size())); |
Copilot
AI
Jul 31, 2025
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.
The magic number 30 should be extracted as a constant or configuration parameter for better maintainability and consistency across the codebase.
| recommendations = recommendations.subList(0, (int) Math.min(30, (long) recommendations.size())); | |
| recommendations = recommendations.subList(0, (int) Math.min(MAX_RECOMMENDATIONS, (long) recommendations.size())); |
|
|
||
| private final RecommendationService recommendationService; | ||
| private final UserSessionService userSessionService; | ||
| private final UserSessionRepository userSessionRepository; |
Copilot
AI
Jul 31, 2025
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.
The userSessionRepository field is injected but never used in this controller. Consider removing unused dependencies to improve code clarity.
| private final UserSessionRepository userSessionRepository; |
| public class RecommendationController { | ||
|
|
||
| private final RecommendationService recommendationService; | ||
| private final UserSessionService userSessionService; |
Copilot
AI
Jul 31, 2025
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.
The userSessionService field is injected but never used in this controller. Consider removing unused dependencies to improve code clarity.
| private final UserSessionService userSessionService; |
| public void generateRecommendationsForSession(UserSession session){ | ||
| User user = session.getUser(); | ||
|
|
||
| List<RouteMission> routeMissions = routeMissionRepository.findAll(); |
Copilot
AI
Jul 31, 2025
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.
Loading all route missions into memory with findAll() can cause performance issues as the dataset grows. Consider implementing pagination or filtering at the database level.
|
|
||
| List<ChallengeRecommendation> recommendations = routeMissions.stream() | ||
| .filter(routeMission -> | ||
| routeMission.getAttempts().stream().noneMatch(userMissionAttempt -> userMissionAttempt.getUser().getId().equals(user.getId())) |
Copilot
AI
Jul 31, 2025
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 filtering logic creates an N+1 query problem. Each route mission will trigger a separate query to load attempts. Consider using a custom query with JOIN to fetch non-attempted missions efficiently.
6478e0b to
e5782a0
Compare
|
Claude finished @eric-jy-park's task —— View job 할 일 목록:
리뷰 요약세션 생성 시 루트미션 추천 기능이 구현되었습니다. 기본적인 구조는 잘 설계되었으나, 성능과 데이터 검증 측면에서 개선이 필요합니다. 특히
코드 리뷰RecommendationServiceImpl.java:37 - issue: RecommendationServiceImpl.java:42-44 - issue: N+1 쿼리 문제 - 각 루트미션마다 attempts를 별도 조회하여 성능 저하, fetch join 사용하여 한 번에 로드 필요 RecommendationServiceImpl.java:56 - issue: 하드코딩된 추천 개수 제한 - 30개로 고정되어 있어 유연성 부족, 설정값이나 파라미터로 변경 필요 RecommendationServiceImpl.java:72-74 - suggestion: 중복된 필터링 로직 - 이미 추천 생성 시 필터링했으나 조회 시 다시 필터링, 불필요한 연산 제거 고려 UserMissionAttemptRequest.java:10 - issue: 잘못된 validation 어노테이션 - Long 타입에 AttemptController.java:65 - issue: 빈 객체 반환 - 실제 구현 없이 빈 응답 객체만 반환, 임시 구현이라도 적절한 에러 메시지나 구현 예정 안내 필요 |
|
Claude finished @eric-jy-park's task —— View job 할 일 목록:
리뷰 요약세션 생성 시 루트미션 추천 기능이 구현되었습니다. 기본적인 구조는 잘 설계되었으나, 성능과 데이터 검증 측면에서 개선이 필요합니다. 특히
코드 리뷰RecommendationServiceImpl.java:53 - issue: 하드코딩된 추천 개수 제한 - 30개로 고정되어 있어 유연성 부족, 설정값이나 파라미터로 변경 필요 RecommendationServiceImpl.java:67 - issue: N+1 쿼리 문제 - 각 루트미션마다 attempts를 별도 조회하여 성능 저하, fetch join 사용하여 한 번에 로드 필요 RecommendationController.java:33-34 - suggestion: 사용하지 않는 의존성 - userSessionService와 userSessionRepository가 주입되었으나 사용되지 않음, 불필요한 의존성 제거 고려 AttemptController.java:109 - issue: 빈 객체 반환 - 실제 구현 없이 빈 응답 객체만 반환, 임시 구현이라도 적절한 에러 메시지나 구현 예정 안내 필요 |
|
Claude finished @eric-jy-park's task —— View job 할 일 목록:
리뷰 요약세션 생성 시 루트미션 추천 기능이 구현되었습니다. 기본적인 구조는 잘 설계되었으나, 성능과 데이터 검증 측면에서 개선이 필요합니다. 특히
코드 리뷰RecommendationServiceImpl.java:53 - issue: 하드코딩된 추천 개수 제한 - 30개로 고정되어 있어 유연성 부족, 설정값이나 파라미터로 변경 필요 RecommendationServiceImpl.java:67 - issue: N+1 쿼리 문제 - 각 루트미션마다 attempts를 별도 조회하여 성능 저하, fetch join 사용하여 한 번에 로드 필요 RecommendationController.java:33-34 - suggestion: 사용하지 않는 의존성 - userSessionService와 userSessionRepository가 주입되었으나 사용되지 않음, 불필요한 의존성 제거 고려 AttemptController.java:109 - issue: 빈 객체 반환 - 실제 구현 없이 빈 응답 객체만 반환, 임시 구현이라도 적절한 에러 메시지나 구현 예정 안내 필요 |
📌 PR 제목
📋 작업 내용
✅ 체크리스트
🚨 주의사항