diff --git a/app/src/main/java/com/todoroo/astrid/dao/TaskDao.kt b/app/src/main/java/com/todoroo/astrid/dao/TaskDao.kt index 3971daea0..0a9a62f4a 100644 --- a/app/src/main/java/com/todoroo/astrid/dao/TaskDao.kt +++ b/app/src/main/java/com/todoroo/astrid/dao/TaskDao.kt @@ -73,13 +73,7 @@ class TaskDao @Inject constructor( suspend fun save(task: Task) = save(task, fetch(task.id)) suspend fun save(task: Task, original: Task?) { - if (!task.insignificantChange(original)) { - task.modificationDate = DateUtilities.now() - } - if (task.dueDate != original?.dueDate) { - task.reminderSnooze = 0 - } - if (taskDao.update(task) == 1) { + if (taskDao.update(task, original)) { workManager.afterSave(task, original) } } diff --git a/app/src/main/java/org/tasks/data/TaskDao.kt b/app/src/main/java/org/tasks/data/TaskDao.kt index 650b550a7..3f8f98b66 100644 --- a/app/src/main/java/org/tasks/data/TaskDao.kt +++ b/app/src/main/java/org/tasks/data/TaskDao.kt @@ -187,8 +187,18 @@ SELECT EXISTS(SELECT 1 FROM tasks WHERE parent > 0 AND deleted = 0) AS hasSubtas @Insert abstract suspend fun insert(task: Task): Long + suspend fun update(task: Task, original: Task? = null): Boolean { + if (!task.insignificantChange(original)) { + task.modificationDate = DateUtilities.now() + } + if (task.dueDate != original?.dueDate) { + task.reminderSnooze = 0 + } + return updateInternal(task) == 1 + } + @Update - abstract suspend fun update(task: Task): Int + internal abstract suspend fun updateInternal(task: Task): Int suspend fun createNew(task: Task) { task.id = NO_ID