-
Notifications
You must be signed in to change notification settings - Fork 0
동기부여 관련 신규 기능 개발 #73
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
동기부여 관련 신규 기능 개발 #73
Conversation
This reverts commit b404a76.
Jeongminyooa
left a comment
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.
내꺼 코드 부분이랑 싱크 맞춰야 하는 부분들 파악하느라 리뷰가 하루 늦어졌어 ㅠㅠ! 우선 어떤 플로우로 짰는지는 파악은 마쳤고, 내 부분 코드도 싱크 맞추는 작업이 하루 정도 더 소요될 듯해..
리뷰 남긴거 위주로 확인 한번만 부탁할게욥!
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.
해당 파일이랑 FeedbackTemplateProvider 가 entity 패키지 보다는 별도 data_provider 등 패키지로 분류되는게 맞을 것 같아!
| // 오늘 기록된 소비 확인 | ||
| // ver 2.0.0 이후로 기록된 소비만 | ||
| LocalDateTime createdAt = requestDTO.getRecords().get(0).getDate().atStartOfDay(); // 실제 생성일자말고 사용자가 기록하려는 일자 | ||
| LocalDateTime baseTime = LocalDateTime.of(2025, 5, 26, 0, 0); // 2025-05-30 00:00 |
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.
요거는 주석이랑 세팅된 값이랑 다른거 아닌가?!
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.
응응 맞아!
일단 우리 오픈 일정이 30일이라서 그걸로 적어놓은거고, QA 테스트하려면 기준일자 세팅이 필요해서 일단 26일로 설정해놨어!
이건 QA 테스트 완료되면 수정 에정! (비슷한 로직이 ExpenseService에도 있어 이것도 같이 수정)
| List<Feedback> findFeedbackByUserIdAndCreatedAt(Long userId, LocalDateTime date); | ||
|
|
||
| @Query("SELECT f FROM Feedback f JOIN f.user u WHERE u.id = :userId ORDER BY f.createdDate DESC") | ||
| List<Feedback> findFeedbackByUserIdAndCreatedDate(Long userId, LocalDateTime 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.
findFeedbackByUserIdOrderbyCreatedDate -> And로 표현하니까 살짝 헷갈려서 OrderBy 표현해도 좋을 듯!!
| if (feedbacks == null || feedbacks.isEmpty()) { | ||
| return false; | ||
| } else { | ||
| for (Feedback feedback : feedbacks) { |
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.
이 로직은 가장 최근 받은 피드백이 open 이면 getNotOpenedFeedback이 false 라는 로직인건가??
if (feedbacks.get(0).isOpened()) return false;
위랑 다른건가 싶어서!
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.
오 정확해 이렇게 수정해야겠다
| } | ||
| } | ||
|
|
||
| public Boolean getNotOpenedFeedback(String userKey) { |
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.
해당 함수도 boolean 리턴이니까 isNotOpenedFeedback 네이밍 통일해주면 좋을 듯!
|
|
||
| Feedback notOpenedFeedback = new Feedback(); | ||
|
|
||
| for (Feedback feedback : feedbacks) { |
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.
이 부분도 동일하게 feedbacks의 첫번째 엘리먼트의 isOpened()의 t/f 확인해서 분기 태워도 되지 않을까?
| // 3. 획득한 피드백의 템플릿 확인 | ||
| List<FeedbackTemplate> remainTemplates; | ||
|
|
||
| List<String> usedTitles = feedbackRepository.findFeedbackByUserIdUsedTitle(user.getId()); |
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.
지금 로직이면 usedTitles가 소비 기록이 계속 쌓이고 피드백을 계속 받으면 모든 피드백 문구에 대해 used 상태일 것 같은데, 그렇게 되면 결국 밑에 필터링하는 로직 자체가 무의미해질 수도 있을 것 같아.
피드백 문구에 대한 재사용 방지 정책이 월 단위로 초기화가 되는건지도 고려되면 좋을 듯!
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.
결국 5번에서 filter 의미가 사라지고 아래 코드만 쓰이는 셈 되지 않을까 싶은 우려가 있어 남겨봅니다.
// 모두 사용했으면 해당 카테고리에 해당하는 템플릿 전체
if (notUsedTemplates.isEmpty()) {
notUsedTemplates = allTemplates;
}
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.
맞아!
현재 로직 기준으로는 6개 이상부터는 리뷰 달아준 대로 해당 로직만 타게 됨...
일단 API 배포에 우선 순위를 둬서 이 로직도 최대한 빨리 수정해볼게 (매섭군요!)
| Boolean isNotOpened = feedbackService.getNotOpenedFeedback(userKey); | ||
| Boolean isFirstOpened = feedbackService.isFirstOpenedFeedback(userKey); | ||
|
|
||
| if (!isNotOpened && isFirstOpened) { |
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.
이 부분이 잘 이해가 안가는데 혹시 추가 설명해줄 수 있으려나..?!
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.
피드백이 다 open된 상태이고, 피드백 받은 것이 1개도 없을 때
isFirstOpened가 false가 되는건가..?
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.
기존에 findFeedbackByUserIdAndCreatedAt호출해서 데이터를 갖고 오다보니
isNotOpen = false, isFirstOpened = true인 케이스가 발생해서 작성해둔 구문이었는데, 이거 지금은 지우는게 맞다...!
|
|
||
| // 1. 피드백 조회 성공 -> 200 | ||
| return ResponseEntity.ok(HttpStatusDTO.response(HttpStatus.OK.value(), "성공", feedbackNotOpenedResponseDTO)); | ||
| } catch (Exception e) { |
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.
이 catch는 어떤 조건일 때 예외를 잡는거야?? service 단에서 throw 하는 부분이 없는 것 같아서 물어봐유
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.
userService의 getUser(userKey)에서 유저 정보가 없는 경우에 대한 Exception!
#️⃣ 연관된 이슈
📝 작업 내용