-
Notifications
You must be signed in to change notification settings - Fork 3
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
[BE] 주변 발자국 조회 hotfix & 더미데이터 추가 #294
Conversation
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.
사소한 코멘트 남겨봤어요~~
@AfterEach | ||
void setDown() { | ||
footprintRepository.deleteAll(); | ||
} |
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.
fyi
보통은 tearDown이라고 쓰는 것 같아요!!!
@@ -43,6 +44,7 @@ void findOne() { | |||
); | |||
} | |||
|
|||
@Disabled |
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.
아예 삭제하거나, assert 문을 바꿔도 좋겠네요!
return recentFootprints.stream() | ||
.filter(footprint -> footprint.isNear(currentLocation)) | ||
.filter(footprint -> !footprint.isDeleted()) | ||
.map(footprint -> new FindNearFootprintResponse(footprint, footprint.isCreatedBy(memberId))) |
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.
return recentFootprints.stream() | |
.filter(footprint -> footprint.isNear(currentLocation)) | |
.filter(footprint -> !footprint.isDeleted()) | |
.map(footprint -> new FindNearFootprintResponse(footprint, footprint.isCreatedBy(memberId))) | |
return recentFootprints.stream() | |
.filter(footprint -> !footprint.isDeleted() && footprint.isNear(currentLocation)) | |
.map(footprint -> new FindNearFootprintResponse(footprint, footprint.isCreatedBy(memberId))) |
혹시라도 범위 내 조회가 부활한다면 이렇게 수정하면 좋을 것 같아요.
- filter를 중복으로 쓰면 불필요한 객체 생성이 일어나서 성능에 좋지 못해요. 참고 링크
- 조건 검사의 순서 이야기인데요. 나중에 데이터가 쌓이면 논리 삭제 되어 있는 발자국이, 그렇지 않은 발자국보다 많아질 것 같아요.
&&
는 도도도 잘 아시겠지만 앞의 조건이 false이면 뒤 조건을 검사하지 않기 때문에,!isDeleted
를 먼저 검사하도록 바꾸면 불필요한isNear
검사가 줄어들 것 같네요!
} | ||
|
||
public boolean isNear(Location location) { | ||
return this.location.isWithin(location, RADIUS_AS_METER); | ||
return this.location.isWithin(location, NEAR_RADIUS_AS_METER); |
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.
다시 부활할 가능성이 높다생각했기에 지우지않고 반경을 대한민국전체로 바꿨습니다
FOOTPRINT_DELETED() | ||
) | ||
); | ||
System.out.println(footprintRepository.findAll().size()); |
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.
예리하네요
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.
이거뭐지?
Test Results127 tests 127 ✅ 14s ⏱️ Results for commit 41b7ac3. ♻️ This comment has been updated with latest results. |
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.
LGTM!!
이슈
개발 사항