Distribute cloned tasks on weeks
All checks were successful
Java CI with Maven / build-and-push-frontend (push) Successful in 8s
Java CI with Maven / build-and-push-backend (push) Successful in 7s

This commit is contained in:
Sebastian Böckelmann 2024-04-19 09:51:14 +02:00
parent bc239f9b86
commit 57be3393c9

View File

@ -62,6 +62,7 @@ public class TaskSeriesService {
List<AbstractSchedule> clonedSchedules = new ArrayList<>(); List<AbstractSchedule> clonedSchedules = new ArrayList<>();
LocalDate currentDate = rootTask.getStartDate().plusDays(offsetMap.get(rootTask)); LocalDate currentDate = rootTask.getStartDate().plusDays(offsetMap.get(rootTask));
long index = 1;
while(currentDate.isBefore(endingDate)) { while(currentDate.isBefore(endingDate)) {
var cloneResult = rootTask.cloneTask(); var cloneResult = rootTask.cloneTask();
Task clonedRootTask = cloneResult.getValue00(); Task clonedRootTask = cloneResult.getValue00();
@ -73,10 +74,11 @@ public class TaskSeriesService {
taskSerie.addItem(item); taskSerie.addItem(item);
} }
clonedRootTask.shiftTask(offsetMap.get(rootTask)); clonedRootTask.shiftTask(index * offsetMap.get(rootTask));
currentDate = currentDate.plusDays(offsetMap.get(rootTask)); currentDate = currentDate.plusDays(offsetMap.get(rootTask));
itemIndex += offsetMap.size(); itemIndex += offsetMap.size();
index++;
} }
return new Tupel<>(clonedTasks, clonedSchedules); return new Tupel<>(clonedTasks, clonedSchedules);