diff --git a/src/main/java/ch/zhaw/gartenverwaltung/CropDetailController.java b/src/main/java/ch/zhaw/gartenverwaltung/CropDetailController.java index 826e5b9..52fbfb2 100644 --- a/src/main/java/ch/zhaw/gartenverwaltung/CropDetailController.java +++ b/src/main/java/ch/zhaw/gartenverwaltung/CropDetailController.java @@ -12,6 +12,7 @@ import ch.zhaw.gartenverwaltung.types.Crop; import ch.zhaw.gartenverwaltung.types.Pest; import ch.zhaw.gartenverwaltung.types.Plant; import ch.zhaw.gartenverwaltung.types.Task; +import javafx.application.Platform; import javafx.beans.property.ListProperty; import javafx.beans.property.SimpleListProperty; import javafx.collections.FXCollections; @@ -133,8 +134,14 @@ public class CropDetailController { initializeTaskListProperty(crop); TaskList.TaskListObserver taskListObserver = newTaskList -> { - taskListProperty.clear(); - taskListProperty.addAll(gardenSchedule.getTaskListForCrop(crop.getCropId().get())); + Platform.runLater(() -> { + taskListProperty.clear(); + try { + taskListProperty.addAll(gardenSchedule.getTaskListForCrop(crop.getCropId().get())); + } catch (IOException e) { + e.printStackTrace(); + } + }); }; gardenSchedule.setTaskListObserver(taskListObserver); diff --git a/src/main/java/ch/zhaw/gartenverwaltung/Main.java b/src/main/java/ch/zhaw/gartenverwaltung/Main.java index f757926..94390db 100644 --- a/src/main/java/ch/zhaw/gartenverwaltung/Main.java +++ b/src/main/java/ch/zhaw/gartenverwaltung/Main.java @@ -28,7 +28,7 @@ public class Main extends Application { stage.setTitle("Gartenverwaltung"); stage.show(); - backGroundTaskTimer.scheduleAtFixedRate(backgroundTasks, 0, 60000); + backGroundTaskTimer.scheduleAtFixedRate(backgroundTasks, 0, 10000); } diff --git a/src/main/java/ch/zhaw/gartenverwaltung/backgroundtasks/BackgroundTasks.java b/src/main/java/ch/zhaw/gartenverwaltung/backgroundtasks/BackgroundTasks.java index eea692a..ae56dab 100644 --- a/src/main/java/ch/zhaw/gartenverwaltung/backgroundtasks/BackgroundTasks.java +++ b/src/main/java/ch/zhaw/gartenverwaltung/backgroundtasks/BackgroundTasks.java @@ -24,7 +24,7 @@ public class BackgroundTasks extends TimerTask { private final WeatherGradenTaskPlanner weatherGardenTaskPlaner; private void movePastTasks() throws IOException { - List taskList = this.taskList.getTaskList(LocalDate.MIN, LocalDate.now().minusDays(1)); + List taskList = this.taskList.getTaskList(LocalDate.MIN.plusDays(1), LocalDate.now().minusDays(1)); for (Task task : taskList) { if (!task.isDone()) { task.setNextExecution(LocalDate.now());