Skip to content
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

fix: 일기가 존재하는 날짜 반환 기능에서 리스트 중복 제거 로직 추가 #25

Merged
merged 4 commits into from
Nov 24, 2023

Conversation

Ji-soo708
Copy link
Member

개요

  • 특정 달에서 일기가 존재하는 날짜들을 리스트로 반환하는 기존 로직에서는 같은 날에 일기를 2개 이상 작성하면 같은 날짜가 중복해서 반환됐습니다. 그럴 필요가 없기 때문에 같은 날짜가 중복해서 들어가지 않도록 로직을 추가했습니다.

작업사항

  • stream을 통해 날짜 반환 리스트에서 중복 제거 로직 추가

주의사항

  • 기능이 제대로 동작하는지 다시 한 번 확인해주세요

@Ji-soo708 Ji-soo708 added 🚨버그🚨 버그 해결 ✨ 기능 구현 기능 구현 labels Nov 23, 2023
@Ji-soo708 Ji-soo708 self-assigned this Nov 23, 2023
@Ji-soo708 Ji-soo708 requested a review from 0703kyj November 23, 2023 14:30
@Ji-soo708 Ji-soo708 changed the title fix: 일기가 존재하는 날짜 반환 리스트 중복 제거 로직 추가 fix: 일기가 존재하는 날짜 반환 기능에서 리스트 중복 제거 로직 추가 Nov 23, 2023
Copy link
Contributor

@0703kyj 0703kyj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

동작확인했습니다! 고생하셨습니다! 합쳐도 문제없을 것 같은데 distinct자체를 getDiaryDates안으로 넣는게 조금 더 깔끔해보여서 코멘트 남겼어요! 확인부탁드릴게요 :)

@@ -128,7 +123,9 @@ public DiaryDateResponse findExistingDiaryDate(Long memberId, int year, int mont
Timestamp start = Timestamp.valueOf(startDate);
Timestamp end = Timestamp.valueOf(endDate);

List<LocalDate> dateList = getDiaryDates(member, start, end);
List<LocalDate> dateList = getDiaryDates(member, start, end).stream()
.distinct()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

distinct() 자체를 getDiaryDates안으로 넣는건 어떨까요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그 방법을 놓쳤네요 ㅎㅎ.. 수정했습니다~

@Ji-soo708 Ji-soo708 removed the ✨ 기능 구현 기능 구현 label Nov 24, 2023
@Ji-soo708 Ji-soo708 merged commit 4c96db3 into main Nov 24, 2023
1 check passed
@Ji-soo708 Ji-soo708 deleted the fix/diary-calendar-get branch November 24, 2023 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨버그🚨 버그 해결
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants