From 57be3393c9ce5712e74bb569430b958905d00743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Fri, 19 Apr 2024 09:51:14 +0200 Subject: [PATCH] Distribute cloned tasks on weeks --- backend/src/main/java/core/services/TaskSeriesService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/core/services/TaskSeriesService.java b/backend/src/main/java/core/services/TaskSeriesService.java index fbfbf22..a2094c8 100644 --- a/backend/src/main/java/core/services/TaskSeriesService.java +++ b/backend/src/main/java/core/services/TaskSeriesService.java @@ -62,6 +62,7 @@ public class TaskSeriesService { List clonedSchedules = new ArrayList<>(); LocalDate currentDate = rootTask.getStartDate().plusDays(offsetMap.get(rootTask)); + long index = 1; while(currentDate.isBefore(endingDate)) { var cloneResult = rootTask.cloneTask(); Task clonedRootTask = cloneResult.getValue00(); @@ -73,10 +74,11 @@ public class TaskSeriesService { taskSerie.addItem(item); } - clonedRootTask.shiftTask(offsetMap.get(rootTask)); + clonedRootTask.shiftTask(index * offsetMap.get(rootTask)); currentDate = currentDate.plusDays(offsetMap.get(rootTask)); itemIndex += offsetMap.size(); + index++; } return new Tupel<>(clonedTasks, clonedSchedules);