-
Notifications
You must be signed in to change notification settings - Fork 0
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
M3-140 픽셀 개인전 정보를 가져오는 API 다시 만들기 #8
Conversation
📝 테스트 커버리지 리포트
|
Qodana for JVMIt seems all right 👌 No new problems were found according to the checks applied 💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at qodana-support@jetbrains.com
|
📝 테스트 커버리지 리포트
|
📝 테스트 커버리지 리포트
|
📝 테스트 커버리지 리포트
|
📝 테스트 커버리지 리포트
|
public List<IndividualPixelResponse> getNearIndividualPixelsByCoordinate(double currentLatitude, | ||
double currentLongitude, int radius) { | ||
Point point = geometryFactory.createPoint(new Coordinate(currentLongitude, currentLatitude)); | ||
point.setSRID(4326); |
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.
매직 넘버 아닌가요...
@Query(value = """ | ||
WITH PixelsInRange AS ( | ||
SELECT | ||
p.pixel_id, | ||
p.coordinate, | ||
p.x, | ||
p.y | ||
FROM | ||
pixel p | ||
WHERE | ||
ST_CONTAINS((ST_Buffer(:center, :radius)), p.coordinate) | ||
), | ||
RecentVisits AS ( | ||
SELECT | ||
pu.pixel_id, | ||
pu.user_id, | ||
pu.created_at, | ||
ROW_NUMBER() OVER (PARTITION BY pu.pixel_id ORDER BY pu.created_at DESC) AS rn | ||
FROM | ||
pixel_user pu | ||
JOIN | ||
PixelsInRange pir ON pu.pixel_id = pir.pixel_id | ||
) | ||
SELECT | ||
pir.pixel_id AS pixelId, | ||
pir.coordinate, | ||
rv.user_id AS userId, | ||
pir.x, | ||
pir.y | ||
FROM | ||
PixelsInRange pir | ||
JOIN | ||
RecentVisits rv ON pir.pixel_id = rv.pixel_id | ||
WHERE | ||
rv.rn = 1 | ||
""", nativeQuery = true) |
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.
쿼리 잘 짜셨네요. 저번에 말한 쿼리보다 길긴 하지만 성능이 좋아진 것 같아 좋은 것 같습니다. gis 인덱스가 빠르네요~
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 Response.createSuccess(pixelService.getNearIndividualPixels(currentX, currentY, xRange, yRange)); | ||
@RequestParam(name = "current-latitude") double currentLatitude, | ||
@RequestParam(name = "current-longitude") double currentLongitude, | ||
@RequestParam(name = "radius") int radius) { |
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.
radius이 무엇을 중심으로 하는지 나타내는 것은 어떨까요?
작업 내용*
고민한 내용*
스크린샷