Merge branch 'develop' into frontend/robin
This commit is contained in:
commit
6251a6b25f
@ -991,22 +991,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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1026,7 +1030,7 @@ public class Controller {
|
||||
})
|
||||
@CrossOrigin(origins = "http://localhost:8081") // only for dev purpose
|
||||
@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);
|
||||
|
||||
@ -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, Integer> {
|
||||
Bearbeitet findByUserAndCache(User user, Cache cache);
|
||||
List<Bearbeitet> findByUser(User user);
|
||||
}
|
||||
|
||||
@ -14,14 +14,10 @@ public interface TeamRepository extends JpaRepository<Team, Integer> {
|
||||
|
||||
@Query(value = "SELECT *\n" +
|
||||
"FROM user\n" +
|
||||
"WHERE id = (\n" +
|
||||
"WHERE id IN (\n" +
|
||||
" SELECT user_id\n" +
|
||||
" FROM user_info\n" +
|
||||
" WHERE team_id = (SELECT team_id\n" +
|
||||
" FROM team\n" +
|
||||
" WHERE name = ?1\n" +
|
||||
" )\n" +
|
||||
")", nativeQuery = true)
|
||||
" WHERE team_id = (SELECT team_id FROM team WHERE name = ?1))", nativeQuery = true)
|
||||
List<Object[]> getTeammembers(String name);
|
||||
|
||||
|
||||
|
||||
@ -184,7 +184,8 @@ public class FinderUtil {
|
||||
sendBack.add(tmp);
|
||||
}
|
||||
|
||||
return ResponseEntity.status(200).body(sendBack);
|
||||
|
||||
return ResponseEntity.status(200).body(list);
|
||||
} else {
|
||||
return ResponseEntity.status(404).body("Couldnt find Team member of Team " + name);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user