From 1d3bd1133172c41266bbf48c00e3cb20fe40df74 Mon Sep 17 00:00:00 2001 From: Maximilian Leopold Date: Wed, 8 May 2019 14:19:04 +0200 Subject: [PATCH 1/3] Changed get my Station POIS Method --- .../bugageocaching/controller/Controller.java | 30 +++++++++++-------- .../repositories/BearbeitetRepository.java | 3 ++ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java index f80aea1..8a0c606 100644 --- a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java +++ b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java @@ -1008,22 +1008,26 @@ public class Controller { poisList.add(poi); } - for (Bearbeitet bearbeitet : bearbeitetRepository.findAll()) { - if (bearbeitet.getUser() == user) { - Cache cache = bearbeitet.getCache(); - Station aktuelleStation = bearbeitet.getAktuelleStation(); - int index = cache.getStationen().indexOf(aktuelleStation); - for (int i = 1; i <= index; i++) { - Station station = cache.getStationen().get(i); - int categoryID; - if (i < cache.getStationen().size() - 1) { // isnt endstation - categoryID = 201; - } else { // is endstation - categoryID = 203; + for (Bearbeitet bearbeitet : bearbeitetRepository.findByUser(user)) { + Cache cache = bearbeitet.getCache(); + Station aktuelleStation = bearbeitet.getAktuelleStation(); + int index = cache.getStationen().indexOf(aktuelleStation); + for (int i = 1; i <= index; i++) { + Station station = cache.getStationen().get(i); + int categoryID; + if (i < cache.getStationen().size() - 1) { // isnt endstation + categoryID = 201; + if (i == index) { + POI poi = new POI(cache.getName() + "_Station" + (i + 1), (float) station.getLattitude(), (float) station.getLongitude(), categoryID); + poisList.add(poi); } + } else { // is endstation + categoryID = 203; POI poi = new POI(cache.getName() + "_Station" + (i + 1), (float) station.getLattitude(), (float) station.getLongitude(), categoryID); poisList.add(poi); } + //POI poi = new POI(cache.getName() + "_Station" + (i + 1), (float) station.getLattitude(), (float) station.getLongitude(), categoryID); + //poisList.add(poi); } } @@ -1042,7 +1046,7 @@ public class Controller { @ApiResponse(code = 400, message = "Something went wrong at verification") }) @RequestMapping(value = "/api/getTeamOfUser", method = RequestMethod.GET, produces = "application/json") - public ResponseEntity getTeamOfUser(@RequestParam String token){ + public ResponseEntity getTeamOfUser(@RequestParam String token) { // verify user ResponseEntity verifyToken = VerificationUtil.verifyToken(token); diff --git a/src/main/java/hhn/labsw/bugageocaching/repositories/BearbeitetRepository.java b/src/main/java/hhn/labsw/bugageocaching/repositories/BearbeitetRepository.java index 4b5c1a0..291fe9c 100644 --- a/src/main/java/hhn/labsw/bugageocaching/repositories/BearbeitetRepository.java +++ b/src/main/java/hhn/labsw/bugageocaching/repositories/BearbeitetRepository.java @@ -6,6 +6,9 @@ import hhn.labsw.bugageocaching.entities.User; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.repository.CrudRepository; +import java.util.List; + public interface BearbeitetRepository extends JpaRepository { Bearbeitet findByUserAndCache(User user, Cache cache); + List findByUser(User user); } From faa21575a8e2ade782eeb4c46b32df4c61f7b4e8 Mon Sep 17 00:00:00 2001 From: Maximilian Leopold Date: Thu, 9 May 2019 13:11:40 +0200 Subject: [PATCH 2/3] Merged --- aaa.html | 20 +++++++ build.gradle | 3 + frontend/quasar.conf.js | 4 +- frontend/src/pages/CacheStart.vue | 56 +++++++++++++++++-- frontend/src/pages/Overview.vue | 31 +++++++++- frontend/src/pages/ranking.vue | 40 +++++++++++-- .../bugageocaching/controller/Controller.java | 27 ++------- .../bugageocaching/util/VerificationUtil.java | 5 +- 8 files changed, 148 insertions(+), 38 deletions(-) create mode 100644 aaa.html diff --git a/aaa.html b/aaa.html new file mode 100644 index 0000000..aa143ea --- /dev/null +++ b/aaa.html @@ -0,0 +1,20 @@ + + + + BuGa Lageplan + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 841dd55..e2a06be 100644 --- a/build.gradle +++ b/build.gradle @@ -58,6 +58,9 @@ dependencies { compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.0.2' + // https://mvnrepository.com/artifact/com.mashape.unirest/unirest-java + compile group: 'com.mashape.unirest', name: 'unirest-java', version: '1.3.1' + } node { diff --git a/frontend/quasar.conf.js b/frontend/quasar.conf.js index 4df0238..7e353ec 100644 --- a/frontend/quasar.conf.js +++ b/frontend/quasar.conf.js @@ -111,12 +111,12 @@ module.exports = function (ctx) { ? { // Base URL for API-Calls: DEV API: JSON.stringify('http://localhost:8080'), // API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19geocaching'), - USER_API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19usermanagement') + USER_API: JSON.stringify('https://seserver.se.hs-heilbronn.de:9443/buga19usermanagement') } : { // Base URL for API-Calls: PRODUCTION (build) API: JSON.stringify('http://localhost:8080'), //API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19geocaching'), - USER_API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19usermanagement') + USER_API: JSON.stringify('https://seserver.se.hs-heilbronn.de:9443/buga19usermanagement') } }, diff --git a/frontend/src/pages/CacheStart.vue b/frontend/src/pages/CacheStart.vue index 635b544..2973271 100644 --- a/frontend/src/pages/CacheStart.vue +++ b/frontend/src/pages/CacheStart.vue @@ -1,11 +1,11 @@