Skip to content

Commit

Permalink
fix: renamed method in CarWashRepository due map position.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirollbas committed Aug 14, 2023
1 parent f1ddcfb commit 74dc050
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@AllArgsConstructor
@Embeddable
public class MapPosition {
public MapPosition(){};
public MapPosition(){}

private double latitude;
private double longitude;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
public interface CarWashRepository extends JpaRepository<CarWash, Integer> {
CarWash findByAccount(Account account);

List<CarWash> findByLatitudeIsBetweenAndLongitudeIsBetween(double latitudeBottom,
List<CarWash> findByMapPosition_LatitudeIsBetweenAndMapPosition_LongitudeIsBetween(double latitudeBottom,
double latitudeTop,
double longitudeBottom,
double longitudeTop);

default List<CarWash> findCarWashesInSquare(double centerLatitude, double centerLongitude, double radius){
double latitudeShift = (180 * radius)/(Math.PI * 6378100);
double longitudeShift = (180 * radius)/(Math.PI * 6356800);
return findByLatitudeIsBetweenAndLongitudeIsBetween(
return findByMapPosition_LatitudeIsBetweenAndMapPosition_LongitudeIsBetween(
centerLatitude - latitudeShift,
centerLatitude + latitudeShift,
centerLongitude - longitudeShift,
Expand Down

0 comments on commit 74dc050

Please sign in to comment.