Merge branch 'develop' into frontend/timo

This commit is contained in:
Timo Volkmann 2019-05-07 22:57:59 +02:00
commit b8ecb2a93b
3 changed files with 8 additions and 9 deletions

View File

@ -17,6 +17,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -456,7 +457,8 @@ public class Controller {
List<TeamRankingListHelper> sendBackTeams = new LinkedList<>(); List<TeamRankingListHelper> sendBackTeams = new LinkedList<>();
List<Object[]> rankingTeams = userRepository.getTeamRankingList(); List<Object[]> rankingTeams = userRepository.getTeamRankingList();
for (Object[] obj : rankingTeams) { 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); System.out.println(tmp);
sendBackTeams.add(tmp); sendBackTeams.add(tmp);
} }
@ -1002,8 +1004,7 @@ public class Controller {
ArrayList<POI> poisList = new ArrayList<>(); ArrayList<POI> poisList = new ArrayList<>();
for (Cache cache : cacheRepository.findAll()) { for (Cache cache : cacheRepository.findAll()) {
Station station = cache.getStationen().get(0); 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(), 202);
POI poi = new POI(cache.getName() + "_Station1", (float) station.getLattitude(), (float) station.getLongitude(), 0);
poisList.add(poi); poisList.add(poi);
} }
@ -1014,12 +1015,11 @@ public class Controller {
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);
// ICONS müssen noch erstellt werden und die categoryID entsprechend angepasst
int categoryID; int categoryID;
if (i < cache.getStationen().size() - 1) { // isnt endstation if (i < cache.getStationen().size() - 1) { // isnt endstation
categoryID = 1; categoryID = 201;
} else { // is endstation } else { // is endstation
categoryID = 2; 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);

View File

@ -5,8 +5,7 @@ public class POI {
private String Name; private String Name;
private float Latitude; private float Latitude;
private float Longitude; private float Longitude;
// ICONS müssen noch erstellt werden und die categoryID entsprechend angepasst private int CategoryID; // 202 = grünes icon(startstation) // 201 = blaues icon(folgestationen) // 203 = rotes icon(endstation)
private int CategoryID; // 0 = grünes icon(startstation) // 1 = orangenes icon(folgestationen) // 2 = rotes icon(endstation)
public POI(String name, float latitude, float longitude, int categoryID) { public POI(String name, float latitude, float longitude, int categoryID) {
Name = name; Name = name;

View File

@ -45,7 +45,7 @@ public interface UserRepository extends CrudRepository<User, Integer> {
" AND t.id = ui.team_id\n" + " AND t.id = ui.team_id\n" +
" AND ui.team_id IS NOT NULL\n" + " AND ui.team_id IS NOT NULL\n" +
"GROUP BY teamname\n" + "GROUP BY teamname\n" +
"ORDER by ranking_points_sum DESC" + "ORDER by ranking_points_sum DESC\n" +
"LIMIT 10;", nativeQuery = true) "LIMIT 10;", nativeQuery = true)
List<Object[]> getTeamRankingList(); List<Object[]> getTeamRankingList();