modified checkStation

This commit is contained in:
Michael 2019-04-13 21:41:24 +02:00
parent ff7ddde5ee
commit d14a4b5d86

View File

@ -232,6 +232,16 @@ public class Controller {
if (cache.getStationen().get(i - 1).equals(aktuelleStation)) {
bearbeitet.setAktuelleStation(station);
if (i == cache.getStationen().size() - 1) { // letze Station erreicht
Optional<CacheAccesDefinition> cacheAccesDefinitionOptional =
cacheAccesDefinitionRepository.findById(1); // abgeschlossen
if (cacheAccesDefinitionOptional.isPresent()) {
CacheAccesDefinition cacheAccesDefinition = cacheAccesDefinitionOptional.get();
bearbeitet.setCacheAccesDefinition(cacheAccesDefinition);
} else {
return ResponseEntity.status(404).body("There is no cacheAccesDefinition with the ID " + 1);
}
}
return ResponseEntity.status(200).body(new Gson().toJson(station));
} else {
return ResponseEntity.status(400).body("The scanned station isn´t the correct following station");