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