issue-117 #119

Merged
sebastian merged 3 commits from issue-117 into master 2024-04-19 10:19:13 +02:00
2 changed files with 6 additions and 2 deletions

View File

@ -75,6 +75,8 @@ public class Task {
clonedSchedules.add(clonedSchedule); clonedSchedules.add(clonedSchedule);
clonedTask.getBasicTaskSchedules().clear(); clonedTask.getBasicTaskSchedules().clear();
clonedTask.getBasicTaskSchedules().add(clonedSchedule); clonedTask.getBasicTaskSchedules().add(clonedSchedule);
clonedSchedule.setTask(clonedTask);
} }
Set<Task> clonedSubtasks = new HashSet<>(); Set<Task> clonedSubtasks = new HashSet<>();

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);
@ -105,7 +107,7 @@ public class TaskSeriesService {
HashMap<Task, Integer> offsetMap = new HashMap<>(); HashMap<Task, Integer> offsetMap = new HashMap<>();
offsetMap.put(rootTask, taskRepeatInfo.getOffset()); offsetMap.put(rootTask, taskRepeatInfo.getOffset());
var repeatingResult = repeatTask(rootTask, taskRepeatInfo.getEndingDate(), offsetMap, taskSerie, 0); var repeatingResult = repeatTask(rootTask, taskRepeatInfo.getEndingDate(), offsetMap, taskSerie, 1);
List<Task> clonedTasks = new ArrayList<>(repeatingResult.getValue00()); List<Task> clonedTasks = new ArrayList<>(repeatingResult.getValue00());
List<AbstractSchedule> clonedSchedules = new ArrayList<>(repeatingResult.getValue01()); List<AbstractSchedule> clonedSchedules = new ArrayList<>(repeatingResult.getValue01());