reversed longitude and latitude

This commit is contained in:
2024-06-13 14:46:37 +02:00
parent 5e74228959
commit 9fd843da78

View File

@@ -13,7 +13,7 @@ import java.util.Vector;
@CrossOrigin(origins = "*", allowedHeaders = "*", maxAge = 3600)
public class Routes {
@GetMapping("/posts/{longitude}/{latitude}")
@GetMapping("/posts/{latitude}/{longitude}")
public Vector<JodelPost> getPostsByLocation(@PathVariable("longitude") float longitude, @PathVariable("latitude") float latitude) {
// list of all posts (not comments) in range
Vector<JodelPost> posts = new Vector<>();
@@ -47,8 +47,8 @@ public class Routes {
posts.title,
posts.content,
posts.postdate,
posts.postlocation[0] AS longitude,
posts.postlocation[1] AS latitude,
posts.postlocation[0] AS latitude,
posts.postlocation[1] AS longitude,
(SELECT count(*) FROM reactions WHERE reactions.post = posts.id AND reactions.positive = TRUE) AS positive,
(SELECT count(*) FROM reactions WHERE reactions.post = posts.id AND reactions.positive = FALSE) AS negative
FROM
@@ -163,8 +163,8 @@ public class Routes {
posts.title,
posts.content,
posts.postdate,
posts.postlocation[0] AS longitude,
posts.postlocation[1] AS latitude,
posts.postlocation[0] AS latitude,
posts.postlocation[1] AS longitude,
(SELECT count(*) FROM reactions WHERE reactions.post = posts.id AND reactions.positive = TRUE) AS positive,
(SELECT count(*) FROM reactions WHERE reactions.post = posts.id AND reactions.positive = FALSE) AS negative
FROM
@@ -266,8 +266,8 @@ public class Routes {
stmt.setObject(2, post.title);
stmt.setObject(3, post.content);
stmt.setObject(4, post.date);
stmt.setObject(5, post.location.longitude);
stmt.setObject(6, post.location.latitude);
stmt.setObject(5, post.location.latitude);
stmt.setObject(6, post.location.longitude);
// insert post and get its id
ResultSet rs = stmt.executeQuery();