issue-77 #105
@ -14,7 +14,7 @@ public class TaskSerieItem {
|
||||
@JoinColumn(referencedColumnName = "taskSerieID")
|
||||
private TaskSerie taskSerie;
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL)
|
||||
@OneToOne
|
||||
@JoinColumn(name = "task_id")
|
||||
private Task task;
|
||||
|
||||
|
@ -35,12 +35,11 @@ public class TaskSeriesService {
|
||||
}
|
||||
|
||||
List<Task> taskList = new ArrayList<>();
|
||||
taskList.add(rootTask);
|
||||
LocalDate currentTaskDate = rootTask.getStartDate().plusDays(taskRepeatInfo.getOffset());
|
||||
TaskSerie taskSerie = new TaskSerie();
|
||||
|
||||
TaskSerieItem rootItem = taskSerie.addTask(rootTask);
|
||||
rootTask.setTaskSerieItem(rootItem);
|
||||
|
||||
LocalDate currentTaskDate = rootTask.getStartDate().plusDays(taskRepeatInfo.getOffset());
|
||||
int index = 2;
|
||||
while(currentTaskDate.isBefore(taskRepeatInfo.getEndingDate())) {
|
||||
Task task = Task.cloneTask(rootTask);
|
||||
@ -69,7 +68,11 @@ public class TaskSeriesService {
|
||||
TaskSerie taskSerie = task.getTaskSerieItem().getTaskSerie();
|
||||
task.setTaskSerieItem(null);
|
||||
taskSerieItemRepository.delete(item);
|
||||
if(taskSerie.getTasks().size() <= 1) {
|
||||
if(taskSerie.getTasks().isEmpty()) {
|
||||
for(TaskSerieItem taskSerieItem : taskSerie.getTasks()) {
|
||||
taskSerieItem.setTaskSerie(null);
|
||||
}
|
||||
taskSerie.getTasks().clear();
|
||||
taskSeriesRepository.delete(taskSerie);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user