small fixes
This commit is contained in:
parent
3ebbb0e0e3
commit
39bff805ac
|
@ -12,6 +12,7 @@ import ch.zhaw.gartenverwaltung.types.Crop;
|
||||||
import ch.zhaw.gartenverwaltung.types.Pest;
|
import ch.zhaw.gartenverwaltung.types.Pest;
|
||||||
import ch.zhaw.gartenverwaltung.types.Plant;
|
import ch.zhaw.gartenverwaltung.types.Plant;
|
||||||
import ch.zhaw.gartenverwaltung.types.Task;
|
import ch.zhaw.gartenverwaltung.types.Task;
|
||||||
|
import javafx.application.Platform;
|
||||||
import javafx.beans.property.ListProperty;
|
import javafx.beans.property.ListProperty;
|
||||||
import javafx.beans.property.SimpleListProperty;
|
import javafx.beans.property.SimpleListProperty;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
|
@ -133,8 +134,14 @@ public class CropDetailController {
|
||||||
initializeTaskListProperty(crop);
|
initializeTaskListProperty(crop);
|
||||||
|
|
||||||
TaskList.TaskListObserver taskListObserver = newTaskList -> {
|
TaskList.TaskListObserver taskListObserver = newTaskList -> {
|
||||||
taskListProperty.clear();
|
Platform.runLater(() -> {
|
||||||
taskListProperty.addAll(gardenSchedule.getTaskListForCrop(crop.getCropId().get()));
|
taskListProperty.clear();
|
||||||
|
try {
|
||||||
|
taskListProperty.addAll(gardenSchedule.getTaskListForCrop(crop.getCropId().get()));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
gardenSchedule.setTaskListObserver(taskListObserver);
|
gardenSchedule.setTaskListObserver(taskListObserver);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class Main extends Application {
|
||||||
stage.setTitle("Gartenverwaltung");
|
stage.setTitle("Gartenverwaltung");
|
||||||
stage.show();
|
stage.show();
|
||||||
|
|
||||||
backGroundTaskTimer.scheduleAtFixedRate(backgroundTasks, 0, 60000);
|
backGroundTaskTimer.scheduleAtFixedRate(backgroundTasks, 0, 10000);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class BackgroundTasks extends TimerTask {
|
||||||
private final WeatherGradenTaskPlanner weatherGardenTaskPlaner;
|
private final WeatherGradenTaskPlanner weatherGardenTaskPlaner;
|
||||||
|
|
||||||
private void movePastTasks() throws IOException {
|
private void movePastTasks() throws IOException {
|
||||||
List<Task> taskList = this.taskList.getTaskList(LocalDate.MIN, LocalDate.now().minusDays(1));
|
List<Task> taskList = this.taskList.getTaskList(LocalDate.MIN.plusDays(1), LocalDate.now().minusDays(1));
|
||||||
for (Task task : taskList) {
|
for (Task task : taskList) {
|
||||||
if (!task.isDone()) {
|
if (!task.isDone()) {
|
||||||
task.setNextExecution(LocalDate.now());
|
task.setNextExecution(LocalDate.now());
|
||||||
|
|
Loading…
Reference in New Issue