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: CHAT-294-일기-스트릭-API-수정 #50

Merged
merged 2 commits into from
Feb 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ public Long streakDate(long userId, LocalDate today){
.setParameter("userId",userId)
.getResultList();

/** 오늘 날짜 기준으로 조회하기위한 조건문
* 연속 기록있어도 조회기준 날짜 즉 오늘 작성 일기 없다면 연속작성 기록 없는거로
/**
* 조회 기준 날짜 하루전으로 일기 스트릭 인정해줌
* */
if (diaries.isEmpty() || !diaries.get(0).getDiaryDate().toLocalDate().equals(today)) {
return 0L;
if (diaries.isEmpty() || !diaries.get(0).getDiaryDate().toLocalDate().equals(today.minusDays(1))) {
if(diaries.get(0).getDiaryDate().toLocalDate().equals(today)){

Copy link
Collaborator

Choose a reason for hiding this comment

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

혹쉬 여기에서
diaries.get(0).getDiaryDate().toLocalDate().equals(today){}안을 비워두신 이유가 있는지 궁금합니다!!

Copy link
Member Author

Choose a reason for hiding this comment

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

오늘 날짜가 조건문에 안걸리고 통과해서 다른 라인 실행하게하려고 작성했습니다. 더 나은 방법이 있겠지만, 당장 떠오르는건 저것뿐이었습니다.

Copy link
Collaborator

Choose a reason for hiding this comment

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

아 그렇군요! 기능상 문제는 없는것같습니다-!

}else{
return 0L;
}
}

long streakCount = 1;
Expand Down
Loading