Merge branch 'develop' of https://bitbucket-student.it.hs-heilbronn.de/scm/labswp19/labswp_2019_sose_geocaching into develop
This commit is contained in:
commit
2feadc12b5
@ -199,21 +199,16 @@
|
||||
this.$store.commit('cacheCollector/RESET_NEW_CACHE');
|
||||
this.$router.push({path: '/overview'});
|
||||
}).catch((error) => {
|
||||
//TODO: Fehlermeldungen
|
||||
// Error
|
||||
let msg;
|
||||
let title;
|
||||
if (error.response) {
|
||||
// The request was made and the server responded with a status code
|
||||
title = "Problem with response!";
|
||||
msg = error.response;
|
||||
title = "Bitte Eingaben überprüfen!";
|
||||
msg = error.response.data;
|
||||
} else if (error.request) {
|
||||
// The request was made but no response was received
|
||||
title = "Problem with request!";
|
||||
msg = "Error occured due to wrong server request!"
|
||||
title = "Verbindungsfehler!";
|
||||
msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!"
|
||||
console.log(error.request);
|
||||
} else {
|
||||
// Something happened in setting up the request that triggered an Error
|
||||
title = "Error";
|
||||
msg = error.message;
|
||||
console.log('Error', error.message);
|
||||
@ -227,7 +222,24 @@
|
||||
console.log("POST api/editCache: " + response.statusText);
|
||||
this.$store.commit('cacheCollector/RESET_NEW_CACHE');
|
||||
this.$router.push({path: '/overview'});
|
||||
})
|
||||
}).catch((error) => {
|
||||
let msg;
|
||||
let title;
|
||||
if (error.response) {
|
||||
title = "Bitte Eingaben überprüfen!";
|
||||
msg = error.response.data;
|
||||
} else if (error.request) {
|
||||
title = "Verbindungsfehler!";
|
||||
msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!"
|
||||
console.log(error.request);
|
||||
} else {
|
||||
title = "Error";
|
||||
msg = error.message;
|
||||
console.log('Error', error.message);
|
||||
}
|
||||
console.log(error.config);
|
||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@ -109,29 +109,24 @@
|
||||
localStorage.setItem('userMail', JSON.stringify(data.email));
|
||||
this.evalAuthentication();
|
||||
this.$router.push({path: `/overview`})
|
||||
})
|
||||
.catch((error) => {
|
||||
let message;
|
||||
let header = "Fehler: ";
|
||||
if (error.response) {
|
||||
console.log("ERROR RESPONSE");
|
||||
// The request was made and the server responded with a status code
|
||||
// that falls out of the range of 2xx
|
||||
message = error.response.data.error;
|
||||
header += error.response.status;
|
||||
} else if (error.request) {
|
||||
// The request was made but no response was received
|
||||
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
|
||||
// http.ClientRequest in node.js
|
||||
message = "Anfrage fehlgeschlagen.";
|
||||
} else {
|
||||
// Something happened in setting up the request that triggered an Error
|
||||
console.log('Error', error.message);
|
||||
message = error.message;
|
||||
}
|
||||
console.log(error.config);
|
||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: message, title: header, });
|
||||
}).finally(() => {
|
||||
}).catch((error) => {
|
||||
let msg;
|
||||
let title;
|
||||
if (error.response) {
|
||||
title = "Fehler!";
|
||||
msg = error.response.data;
|
||||
} else if (error.request) {
|
||||
title = "Verbindungsfehler!";
|
||||
msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!"
|
||||
console.log(error.request);
|
||||
} else {
|
||||
title = "Error";
|
||||
msg = error.message;
|
||||
console.log('Error', error.message);
|
||||
}
|
||||
console.log(error.config);
|
||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
this.evalAuthentication();
|
||||
})
|
||||
|
||||
@ -165,26 +165,22 @@
|
||||
this.initMap();
|
||||
resolve(true);
|
||||
}).catch((error) => {
|
||||
let message;
|
||||
let header = "Fehler: ";
|
||||
let msg;
|
||||
let title;
|
||||
if (error.response) {
|
||||
console.log("ERROR RESPONSE");
|
||||
// The request was made and the server responded with a status code
|
||||
// that falls out of the range of 2xx
|
||||
message = error.response.data.error;
|
||||
header += error.response.status;
|
||||
title = "Bitte Eingaben überprüfen!";
|
||||
msg = error.response.data;
|
||||
} else if (error.request) {
|
||||
// The request was made but no response was received
|
||||
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
|
||||
// http.ClientRequest in node.js
|
||||
message = "Anfrage fehlgeschlagen.";
|
||||
title = "Verbindungsfehler!";
|
||||
msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!"
|
||||
console.log(error.request);
|
||||
} else {
|
||||
// Something happened in setting up the request that triggered an Error
|
||||
title = "Error";
|
||||
msg = error.message;
|
||||
console.log('Error', error.message);
|
||||
message = error.message;
|
||||
}
|
||||
console.log(error.config);
|
||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: message, title: header,});
|
||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
|
||||
resolve(true);
|
||||
})
|
||||
})
|
||||
@ -258,26 +254,22 @@
|
||||
.then((response) => {
|
||||
this.loadData();
|
||||
}).catch((error) => {
|
||||
let message;
|
||||
let header = "Fehler: ";
|
||||
let msg;
|
||||
let title;
|
||||
if (error.response) {
|
||||
console.log("ERROR RESPONSE");
|
||||
// The request was made and the server responded with a status code
|
||||
// that falls out of the range of 2xx
|
||||
message = error.response.data.error;
|
||||
header += error.response.status;
|
||||
title = "Fehler!";
|
||||
msg = error.response.data;
|
||||
} else if (error.request) {
|
||||
// The request was made but no response was received
|
||||
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
|
||||
// http.ClientRequest in node.js
|
||||
message = "Anfrage fehlgeschlagen.";
|
||||
title = "Verbindungsfehler!";
|
||||
msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!"
|
||||
console.log(error.request);
|
||||
} else {
|
||||
// Something happened in setting up the request that triggered an Error
|
||||
title = "Error";
|
||||
msg = error.message;
|
||||
console.log('Error', error.message);
|
||||
message = error.message;
|
||||
}
|
||||
console.log(error.config);
|
||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: message, title: header,});
|
||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
|
||||
})
|
||||
},
|
||||
startCache(cacheID) {
|
||||
@ -299,9 +291,24 @@
|
||||
console.log(response.data);
|
||||
currentStationID = response.data.aktuelleStation.id;
|
||||
this.$router.push({path: `/station/${cacheID}/${currentStationID}`});
|
||||
})
|
||||
.catch((error) => {
|
||||
});
|
||||
}).catch((error) => {
|
||||
let msg;
|
||||
let title;
|
||||
if (error.response) {
|
||||
title = "Fehler!";
|
||||
msg = error.response.data;
|
||||
} else if (error.request) {
|
||||
title = "Verbindungsfehler!";
|
||||
msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!"
|
||||
console.log(error.request);
|
||||
} else {
|
||||
title = "Error";
|
||||
msg = error.message;
|
||||
console.log('Error', error.message);
|
||||
}
|
||||
console.log(error.config);
|
||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
|
||||
})
|
||||
}
|
||||
},
|
||||
goToReward(cacheID) {
|
||||
@ -316,9 +323,24 @@
|
||||
console.log(response.data);
|
||||
currentStationID = response.data.aktuelleStation.id;
|
||||
this.$router.push({path: `/CacheEnd/${params.cacheID}`});
|
||||
})
|
||||
.catch((error) => {
|
||||
});
|
||||
}).catch((error) => {
|
||||
let msg;
|
||||
let title;
|
||||
if (error.response) {
|
||||
title = "Fehler!";
|
||||
msg = error.response.data;
|
||||
} else if (error.request) {
|
||||
title = "Verbindungsfehler!";
|
||||
msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!"
|
||||
console.log(error.request);
|
||||
} else {
|
||||
title = "Error";
|
||||
msg = error.message;
|
||||
console.log('Error', error.message);
|
||||
}
|
||||
console.log(error.config);
|
||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package hhn.labsw.bugageocaching.controller;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import hhn.labsw.bugageocaching.entities.*;
|
||||
import hhn.labsw.bugageocaching.helper.POI;
|
||||
import hhn.labsw.bugageocaching.helper.RankingListHelper;
|
||||
@ -475,6 +476,7 @@ public class Controller {
|
||||
sendBackUsers.add(tmp);
|
||||
}
|
||||
logger.debug("/api/getRankingList Converted Objects to RankingListHelper");
|
||||
logger.debug("/api/getRankingList RankingList: " + new GsonBuilder().setPrettyPrinting().create().toJson(sendBackUsers));
|
||||
return ResponseEntity.status(200).body(new Gson().toJson(sendBackUsers));
|
||||
}
|
||||
|
||||
|
||||
@ -56,24 +56,24 @@ public class CacheConstructionUtil {
|
||||
// Caches werden in die Datenbank eingetragen
|
||||
if (cache.getDescription().length() == 0 || cache.getName().length() == 0 || cache.getRankingPoints() == 0.0) {
|
||||
deleteStationenUtil(cache);
|
||||
return ResponseEntity.status(400).body("cache fields can´t be empty");
|
||||
return ResponseEntity.status(400).body("Alle Felder müssen ausgefüllt werden!");
|
||||
}
|
||||
|
||||
if (cache.getStationen().size() < 2) {
|
||||
deleteStationenUtil(cache);
|
||||
return ResponseEntity.status(400).body("a cache needs atleast 2 stations");
|
||||
return ResponseEntity.status(400).body("Ein Cache muss mindestens zwei Stationen besitzen.\nBitte füge noch eine Station hinzu!");
|
||||
}
|
||||
|
||||
for (Cache cache1 : cacheRepository.findAll()) {
|
||||
if (cache1.getName().equals(cache.getName())) {
|
||||
deleteStationenUtil(cache);
|
||||
return ResponseEntity.status(400).body("name is already taken");
|
||||
return ResponseEntity.status(400).body("Der Cachename ist bereits vergeben. Bitte wähle einen anderen Name!");
|
||||
}
|
||||
}
|
||||
|
||||
if (cache.getRankingPoints() < 0) {
|
||||
deleteStationenUtil(cache);
|
||||
return ResponseEntity.status(400).body("Ranking points has to be a positive number");
|
||||
return ResponseEntity.status(400).body("Die Punkte für den Cache dürfen nicht negativ sein!");
|
||||
}
|
||||
|
||||
cacheRepository.save(cache);
|
||||
@ -84,15 +84,15 @@ public class CacheConstructionUtil {
|
||||
public static ResponseEntity createStationUtil(Station station) {
|
||||
|
||||
if (station.getDescription().length() == 0 || station.getLattitude() == 0.0 || station.getLongitude() == 0.0 /*|| station.getSolution().length() == 0*/) {
|
||||
return ResponseEntity.status(400).body("station fields can´t be empty");
|
||||
return ResponseEntity.status(400).body("Alle Felder müssen ausgefüllt werden!");
|
||||
}
|
||||
|
||||
if (station.getLattitude() < 9 || station.getLattitude() > 10) {
|
||||
return ResponseEntity.status(400).body("Lattitude has to be between 9 and 10 degrees");
|
||||
return ResponseEntity.status(400).body("Die Lattitude ist außerhalb der Bundesgartenschau");
|
||||
}
|
||||
|
||||
if (station.getLongitude() < 49 || station.getLongitude() > 50) {
|
||||
return ResponseEntity.status(400).body("Longitude has to be in the range of 49 to 50 degrees");
|
||||
return ResponseEntity.status(400).body("Die Longitude ist außerhalb der Bundesgartenschau");
|
||||
}
|
||||
|
||||
Random r = new Random();
|
||||
@ -114,7 +114,7 @@ public class CacheConstructionUtil {
|
||||
try {
|
||||
station.setCode(code);
|
||||
} catch (RollbackException e) {
|
||||
return ResponseEntity.status(400).body("There was an error generating the unique code");
|
||||
return ResponseEntity.status(400).body("Es gab einen Fehler beim Konsturieren der QR Codes");
|
||||
}
|
||||
|
||||
stationRepository.save(station);
|
||||
@ -130,7 +130,7 @@ public class CacheConstructionUtil {
|
||||
oldCache = oldCacheOptional.get();
|
||||
// oldStationen = new ArrayList<>(oldCache.getStationen());
|
||||
} else {
|
||||
return ResponseEntity.status(404).body("There isnt a cache with the id " + cache.getId());
|
||||
return ResponseEntity.status(404).body("Es gab einen Fehler. Bitte versuchen Sie es erneut oder kontaktieren Sie einen Admin.");
|
||||
}
|
||||
|
||||
ResponseEntity response = new ResponseEntity(HttpStatus.ACCEPTED);
|
||||
@ -168,26 +168,26 @@ public class CacheConstructionUtil {
|
||||
// überprüft den Cache nach validen Daten
|
||||
if (cache.getDescription().length() == 0 || cache.getName().length() == 0 || cache.getRankingPoints() == 0.0) {
|
||||
deleteNewCreatedStationsUtil(newCreatedStationList);
|
||||
return ResponseEntity.status(400).body("cache fields can´t be empty");
|
||||
return ResponseEntity.status(400).body("Alle Felder müssen ausgefüllt sein!");
|
||||
}
|
||||
|
||||
if (cache.getStationen().size() < 2) {
|
||||
deleteNewCreatedStationsUtil(newCreatedStationList);
|
||||
return ResponseEntity.status(400).body("a cache needs atleast 2 stations");
|
||||
return ResponseEntity.status(400).body("Ein Cache muss mindestens zwei Stationen haben. Bitte füge eine weiter Station hinzu!");
|
||||
}
|
||||
|
||||
for (Cache cache1 : cacheRepository.findAll()) {
|
||||
if (cache1.getName().equals(cache.getName())) {
|
||||
if (cache1.getId() != oldCache.getId()) {
|
||||
deleteNewCreatedStationsUtil(newCreatedStationList);
|
||||
return ResponseEntity.status(400).body("name is already taken");
|
||||
return ResponseEntity.status(400).body("Der Cachename ist bereits vergeben. Bitte wähle einen anderen!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cache.getRankingPoints() < 0) {
|
||||
deleteNewCreatedStationsUtil(newCreatedStationList);
|
||||
return ResponseEntity.status(400).body("Ranking points has to be a positive number");
|
||||
return ResponseEntity.status(400).body("Die Punkte für den Cache dürfen nicht negativ sein!");
|
||||
}
|
||||
|
||||
cacheRepository.save(cache);
|
||||
@ -242,7 +242,7 @@ public class CacheConstructionUtil {
|
||||
public static ResponseEntity deleteCacheUtil(String cacheID) {
|
||||
Optional<Cache> optionalCache = cacheRepository.findById(Integer.valueOf(cacheID));
|
||||
if (!optionalCache.isPresent()) {
|
||||
return ResponseEntity.status(404).body(new Gson().toJson("There is no cache with the ID " + cacheID));
|
||||
return ResponseEntity.status(404).body(new Gson().toJson("Es gab einen Fehler beim Löschen des Caches"));
|
||||
}
|
||||
|
||||
Cache cache = optionalCache.get();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user