From d32d8ca3ea2af17d88d29b8c3a5281fd948cb39d Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 7 May 2019 17:45:28 +0200 Subject: [PATCH 1/3] adjusted categoryID values for POIS --- .../hhn/labsw/bugageocaching/controller/Controller.java | 8 +++----- src/main/java/hhn/labsw/bugageocaching/helper/POI.java | 3 +-- .../labsw/bugageocaching/repositories/UserRepository.java | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java index abd7b33..c695628 100644 --- a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java +++ b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java @@ -1002,8 +1002,7 @@ public class Controller { ArrayList poisList = new ArrayList<>(); for (Cache cache : cacheRepository.findAll()) { Station station = cache.getStationen().get(0); - // ICONS müssen noch erstellt werden und die categoryID entsprechend angepasst - POI poi = new POI(cache.getName() + "_Station1", (float) station.getLattitude(), (float) station.getLongitude(), 0); + POI poi = new POI(cache.getName() + "_Station1", (float) station.getLattitude(), (float) station.getLongitude(), 201); poisList.add(poi); } @@ -1014,12 +1013,11 @@ public class Controller { int index = cache.getStationen().indexOf(aktuelleStation); for (int i = 1; i <= index; i++) { Station station = cache.getStationen().get(i); - // ICONS müssen noch erstellt werden und die categoryID entsprechend angepasst int categoryID; if (i < cache.getStationen().size() - 1) { // isnt endstation - categoryID = 1; + categoryID = 202; } else { // is endstation - categoryID = 2; + categoryID = 203; } POI poi = new POI(cache.getName() + "_Station" + (i + 1), (float) station.getLattitude(), (float) station.getLongitude(), categoryID); poisList.add(poi); diff --git a/src/main/java/hhn/labsw/bugageocaching/helper/POI.java b/src/main/java/hhn/labsw/bugageocaching/helper/POI.java index d6a4051..0e88c13 100644 --- a/src/main/java/hhn/labsw/bugageocaching/helper/POI.java +++ b/src/main/java/hhn/labsw/bugageocaching/helper/POI.java @@ -5,8 +5,7 @@ public class POI { private String Name; private float Latitude; private float Longitude; - // ICONS müssen noch erstellt werden und die categoryID entsprechend angepasst - private int CategoryID; // 0 = grünes icon(startstation) // 1 = orangenes icon(folgestationen) // 2 = rotes icon(endstation) + private int CategoryID; // 201 = grünes icon(startstation) // 202 = blaues icon(folgestationen) // 203 = rotes icon(endstation) public POI(String name, float latitude, float longitude, int categoryID) { Name = name; diff --git a/src/main/java/hhn/labsw/bugageocaching/repositories/UserRepository.java b/src/main/java/hhn/labsw/bugageocaching/repositories/UserRepository.java index d8784ec..af74433 100644 --- a/src/main/java/hhn/labsw/bugageocaching/repositories/UserRepository.java +++ b/src/main/java/hhn/labsw/bugageocaching/repositories/UserRepository.java @@ -45,7 +45,7 @@ public interface UserRepository extends CrudRepository { " AND t.id = ui.team_id\n" + " AND ui.team_id IS NOT NULL\n" + "GROUP BY teamname\n" + - "ORDER by ranking_points_sum DESC" + + "ORDER by ranking_points_sum DESC\n" + "LIMIT 10;", nativeQuery = true) List getTeamRankingList(); From 45d84db3622c304c2ed526b5a0f58c7b84e7ea57 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 7 May 2019 17:54:25 +0200 Subject: [PATCH 2/3] adjusted the categoryIDs again --- .../java/hhn/labsw/bugageocaching/controller/Controller.java | 4 ++-- src/main/java/hhn/labsw/bugageocaching/helper/POI.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java index c695628..ae972b2 100644 --- a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java +++ b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java @@ -1002,7 +1002,7 @@ public class Controller { ArrayList poisList = new ArrayList<>(); for (Cache cache : cacheRepository.findAll()) { Station station = cache.getStationen().get(0); - POI poi = new POI(cache.getName() + "_Station1", (float) station.getLattitude(), (float) station.getLongitude(), 201); + POI poi = new POI(cache.getName() + "_Station1", (float) station.getLattitude(), (float) station.getLongitude(), 202); poisList.add(poi); } @@ -1015,7 +1015,7 @@ public class Controller { Station station = cache.getStationen().get(i); int categoryID; if (i < cache.getStationen().size() - 1) { // isnt endstation - categoryID = 202; + categoryID = 201; } else { // is endstation categoryID = 203; } diff --git a/src/main/java/hhn/labsw/bugageocaching/helper/POI.java b/src/main/java/hhn/labsw/bugageocaching/helper/POI.java index 0e88c13..84631ac 100644 --- a/src/main/java/hhn/labsw/bugageocaching/helper/POI.java +++ b/src/main/java/hhn/labsw/bugageocaching/helper/POI.java @@ -5,7 +5,7 @@ public class POI { private String Name; private float Latitude; private float Longitude; - private int CategoryID; // 201 = grünes icon(startstation) // 202 = blaues icon(folgestationen) // 203 = rotes icon(endstation) + private int CategoryID; // 202 = grünes icon(startstation) // 201 = blaues icon(folgestationen) // 203 = rotes icon(endstation) public POI(String name, float latitude, float longitude, int categoryID) { Name = name; From 4783f8e7c85939319e4aae17cd38a84d90486207 Mon Sep 17 00:00:00 2001 From: Maximilian Leopold Date: Tue, 7 May 2019 18:41:45 +0200 Subject: [PATCH 3/3] Fixed Team Ranking List Call --- .../java/hhn/labsw/bugageocaching/controller/Controller.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java index ae972b2..928bef1 100644 --- a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java +++ b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java @@ -17,6 +17,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.annotation.PostConstruct; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -456,7 +457,8 @@ public class Controller { List sendBackTeams = new LinkedList<>(); List rankingTeams = userRepository.getTeamRankingList(); for (Object[] obj : rankingTeams) { - TeamRankingListHelper tmp = new TeamRankingListHelper((String) obj[0], (Integer) obj[1]); + BigDecimal i = (BigDecimal) obj[1]; + TeamRankingListHelper tmp = new TeamRankingListHelper((String) obj[0], i.intValue()); System.out.println(tmp); sendBackTeams.add(tmp); }