diff --git a/src/main/java/ch/zhaw/gartenverwaltung/models/GardenSchedule.java b/src/main/java/ch/zhaw/gartenverwaltung/models/GardenSchedule.java index 9cb6503..a3eccfa 100644 --- a/src/main/java/ch/zhaw/gartenverwaltung/models/GardenSchedule.java +++ b/src/main/java/ch/zhaw/gartenverwaltung/models/GardenSchedule.java @@ -151,9 +151,8 @@ public class GardenSchedule { if (date.equals(checkDate) && !date.isAfter(task.getEndDate().orElse(LocalDate.MIN))) { dayTaskList.get(finalI).add(task); } - if (task.getInterval().orElse(0) == 0) break; checkDate = checkDate.plusDays(task.getInterval().orElse(0)); - } while (task.getInterval().isPresent() && checkDate.isBefore(LocalDate.now().plusDays(listLength))); + } while (!(task.getInterval().orElse(0) == 0) && checkDate.isBefore(LocalDate.now().plusDays(listLength))); }); } return dayTaskList; diff --git a/src/main/java/ch/zhaw/gartenverwaltung/types/TaskTemplate.java b/src/main/java/ch/zhaw/gartenverwaltung/types/TaskTemplate.java index 9a3d57d..39e349f 100644 --- a/src/main/java/ch/zhaw/gartenverwaltung/types/TaskTemplate.java +++ b/src/main/java/ch/zhaw/gartenverwaltung/types/TaskTemplate.java @@ -42,7 +42,7 @@ public class TaskTemplate { } public Task generateTask(LocalDate realStartDate, long cropId) { - LocalDate endDate = relativeEndDate != null ? realStartDate.plusDays(relativeEndDate) : realStartDate.plusDays(0); + LocalDate endDate = relativeEndDate != null ? realStartDate.plusDays(relativeEndDate) : realStartDate; if (interval == null) { this.interval = 0;