Changed get my Station POIS Method
This commit is contained in:
parent
2c7d47e0f0
commit
1d3bd11331
@ -1008,22 +1008,26 @@ public class Controller {
|
|||||||
poisList.add(poi);
|
poisList.add(poi);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Bearbeitet bearbeitet : bearbeitetRepository.findAll()) {
|
for (Bearbeitet bearbeitet : bearbeitetRepository.findByUser(user)) {
|
||||||
if (bearbeitet.getUser() == user) {
|
Cache cache = bearbeitet.getCache();
|
||||||
Cache cache = bearbeitet.getCache();
|
Station aktuelleStation = bearbeitet.getAktuelleStation();
|
||||||
Station aktuelleStation = bearbeitet.getAktuelleStation();
|
int index = cache.getStationen().indexOf(aktuelleStation);
|
||||||
int index = cache.getStationen().indexOf(aktuelleStation);
|
for (int i = 1; i <= index; i++) {
|
||||||
for (int i = 1; i <= index; i++) {
|
Station station = cache.getStationen().get(i);
|
||||||
Station station = cache.getStationen().get(i);
|
int categoryID;
|
||||||
int categoryID;
|
if (i < cache.getStationen().size() - 1) { // isnt endstation
|
||||||
if (i < cache.getStationen().size() - 1) { // isnt endstation
|
categoryID = 201;
|
||||||
categoryID = 201;
|
if (i == index) {
|
||||||
} else { // is endstation
|
POI poi = new POI(cache.getName() + "_Station" + (i + 1), (float) station.getLattitude(), (float) station.getLongitude(), categoryID);
|
||||||
categoryID = 203;
|
poisList.add(poi);
|
||||||
}
|
}
|
||||||
|
} else { // is endstation
|
||||||
|
categoryID = 203;
|
||||||
POI poi = new POI(cache.getName() + "_Station" + (i + 1), (float) station.getLattitude(), (float) station.getLongitude(), categoryID);
|
POI poi = new POI(cache.getName() + "_Station" + (i + 1), (float) station.getLattitude(), (float) station.getLongitude(), categoryID);
|
||||||
poisList.add(poi);
|
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")
|
@ApiResponse(code = 400, message = "Something went wrong at verification")
|
||||||
})
|
})
|
||||||
@RequestMapping(value = "/api/getTeamOfUser", method = RequestMethod.GET, produces = "application/json")
|
@RequestMapping(value = "/api/getTeamOfUser", method = RequestMethod.GET, produces = "application/json")
|
||||||
public ResponseEntity getTeamOfUser(@RequestParam String token){
|
public ResponseEntity getTeamOfUser(@RequestParam String token) {
|
||||||
|
|
||||||
// verify user
|
// verify user
|
||||||
ResponseEntity verifyToken = VerificationUtil.verifyToken(token);
|
ResponseEntity verifyToken = VerificationUtil.verifyToken(token);
|
||||||
|
|||||||
@ -6,6 +6,9 @@ import hhn.labsw.bugageocaching.entities.User;
|
|||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface BearbeitetRepository extends JpaRepository<Bearbeitet, Integer> {
|
public interface BearbeitetRepository extends JpaRepository<Bearbeitet, Integer> {
|
||||||
Bearbeitet findByUserAndCache(User user, Cache cache);
|
Bearbeitet findByUserAndCache(User user, Cache cache);
|
||||||
|
List<Bearbeitet> findByUser(User user);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user