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

[BE] 주변 발자국 조회 hotfix & 더미데이터 추가 #294

Merged
merged 14 commits into from
Aug 7, 2024

Conversation

ehtjsv2
Copy link
Contributor

@ehtjsv2 ehtjsv2 commented Aug 5, 2024

이슈

개발 사항

  • 주변 발자국 조회 반경을 대한민국 전체로 변경
  • 주변 발자국 조회시 삭제된 발자국은 조회되지 않는다
  • 더미 WalkStatus 다양하게, 한사람이 여러강아지 들고 있도록 추가

@ehtjsv2 ehtjsv2 added 🐞 bug 버그 수정 🖥 backend backend ✨ feat 기능 개발 labels Aug 5, 2024
@ehtjsv2 ehtjsv2 added this to the Sprint3 milestone Aug 5, 2024
@ehtjsv2 ehtjsv2 self-assigned this Aug 5, 2024
@ehtjsv2 ehtjsv2 linked an issue Aug 5, 2024 that may be closed by this pull request
5 tasks
@ehtjsv2 ehtjsv2 requested review from takoyakimchi, J-I-H-O and jimi567 and removed request for takoyakimchi and J-I-H-O August 5, 2024 06:18
Copy link
Contributor

@takoyakimchi takoyakimchi left a comment

Choose a reason for hiding this comment

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

사소한 코멘트 남겨봤어요~~

Comment on lines 121 to 124
@AfterEach
void setDown() {
footprintRepository.deleteAll();
}
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

아예 삭제하거나, assert 문을 바꿔도 좋겠네요!

Comment on lines 59 to 62
return recentFootprints.stream()
.filter(footprint -> footprint.isNear(currentLocation))
.filter(footprint -> !footprint.isDeleted())
.map(footprint -> new FindNearFootprintResponse(footprint, footprint.isCreatedBy(memberId)))
Copy link
Contributor

@takoyakimchi takoyakimchi Aug 5, 2024

Choose a reason for hiding this comment

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

Suggested change
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)))

혹시라도 범위 내 조회가 부활한다면 이렇게 수정하면 좋을 것 같아요.

  1. filter를 중복으로 쓰면 불필요한 객체 생성이 일어나서 성능에 좋지 못해요. 참고 링크
  2. 조건 검사의 순서 이야기인데요. 나중에 데이터가 쌓이면 논리 삭제 되어 있는 발자국이, 그렇지 않은 발자국보다 많아질 것 같아요. &&는 도도도 잘 아시겠지만 앞의 조건이 false이면 뒤 조건을 검사하지 않기 때문에, !isDeleted를 먼저 검사하도록 바꾸면 불필요한 isNear 검사가 줄어들 것 같네요!

J-I-H-O
J-I-H-O previously approved these changes Aug 6, 2024
}

public boolean isNear(Location location) {
return this.location.isWithin(location, RADIUS_AS_METER);
return this.location.isWithin(location, NEAR_RADIUS_AS_METER);
Copy link
Contributor

@J-I-H-O J-I-H-O Aug 6, 2024

Choose a reason for hiding this comment

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

조회 반경 제한을 없앤다면 해당 메서드도 제거해도 되지 않을까요?

Copy link
Contributor Author

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());
Copy link
Contributor

Choose a reason for hiding this comment

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

출력문은 제거해주세요~

Copy link
Contributor

Choose a reason for hiding this comment

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

예리하네요

Copy link
Contributor Author

Choose a reason for hiding this comment

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

이거뭐지?

Copy link

github-actions bot commented Aug 6, 2024

Test Results

127 tests   127 ✅  14s ⏱️
 24 suites    0 💤
 24 files      0 ❌

Results for commit 41b7ac3.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@takoyakimchi takoyakimchi left a comment

Choose a reason for hiding this comment

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

LGTM!!

@ehtjsv2 ehtjsv2 merged commit 8dc5b98 into develop Aug 7, 2024
3 checks passed
@ehtjsv2 ehtjsv2 deleted the feature/footprint-near branch August 7, 2024 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🖥 backend backend 🐞 bug 버그 수정 ✨ feat 기능 개발
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

발자국 기능 hotfix
4 participants