Fix duplicated subtasks

pull/2318/head
Alex Baker 2 years ago
parent fce12ae4a8
commit 02958e46e6

@ -293,6 +293,20 @@ class TaskEditViewModel @Inject constructor(
task.modificationDate = currentTimeMillis()
}
if (!task.hasStartDate()) {
selectedAlarms.value = selectedAlarms.value.filterNot { a -> a.type == TYPE_REL_START }
}
if (!task.hasDueDate()) {
selectedAlarms.value = selectedAlarms.value.filterNot { a -> a.type == TYPE_REL_END }
}
taskDao.save(task, null)
if (isNew || originalList != selectedList.value) {
task.parent = 0
taskMover.move(listOf(task.id), selectedList.value)
}
for (subtask in newSubtasks.value) {
if (Strings.isNullOrEmpty(subtask.title)) {
continue
@ -324,20 +338,6 @@ class TaskEditViewModel @Inject constructor(
}
}
if (!task.hasStartDate()) {
selectedAlarms.value = selectedAlarms.value.filterNot { a -> a.type == TYPE_REL_START }
}
if (!task.hasDueDate()) {
selectedAlarms.value = selectedAlarms.value.filterNot { a -> a.type == TYPE_REL_END }
}
taskDao.save(task, null)
if (isNew || originalList != selectedList.value) {
task.parent = 0
taskMover.move(listOf(task.id), selectedList.value)
}
if (
selectedAlarms.value.toHashSet() != originalAlarms.toHashSet() ||
(isNew && selectedAlarms.value.isNotEmpty())

Loading…
Cancel
Save