Change CaldavTask to val

pull/2349/head
Alex Baker 1 year ago
parent b0bb58bb4c
commit 53738031d1

@ -196,7 +196,6 @@ class CaldavTaskAdapterTest : InjectingTestCase() {
private fun addTask(vararg properties: PropertyValue<in TaskContainer?, *>) = runBlocking {
val t = newTaskContainer(*properties)
tasks.add(t)
val task = t.task
taskDao.createNew(task)
val caldavTask = CaldavTask(t.id, "calendar")
@ -204,6 +203,8 @@ class CaldavTaskAdapterTest : InjectingTestCase() {
caldavTask.remoteParent = caldavDao.getRemoteIdForTask(task.parent)
}
caldavTask.id = caldavDao.insert(caldavTask)
t.caldavTask = caldavTask
tasks.add(
t.copy(caldavTask = caldavTask)
)
}
}

@ -146,7 +146,6 @@ class CaldavDaoShiftTests : InjectingTestCase() {
private suspend fun addTask(calendar: String, vararg properties: PropertyValue<in TaskContainer?, *>) {
val t = TaskContainerMaker.newTaskContainer(*properties)
tasks.add(t)
val task = t.task
taskDao.createNew(task)
val caldavTask = CaldavTask(t.id, calendar)
@ -154,6 +153,8 @@ class CaldavDaoShiftTests : InjectingTestCase() {
caldavTask.remoteParent = caldavDao.getRemoteIdForTask(task.parent)
}
caldavTask.id = caldavDao.insert(caldavTask)
t.caldavTask = caldavTask
tasks.add(
t.copy(caldavTask = caldavTask)
)
}
}

@ -146,7 +146,6 @@ open class TaskAdapter(
} else if (newParent != null) {
if (task.caldav != newParent.caldav) {
caldavDao.markDeleted(listOf(task.id))
task.caldavTask = null
}
}
when {
@ -258,8 +257,11 @@ open class TaskAdapter(
)
} else {
task.parent = newParent.id
task.caldavTask = CaldavTask(task.id, list, remoteId = null)
googleTaskDao.insertAndShift(task.task, task.caldavTask!!, newTasksOnTop)
googleTaskDao.insertAndShift(
task = task.task,
caldavTask = CaldavTask(task.id, list, remoteId = null),
top = newTasksOnTop
)
}
taskDao.touch(task.id)
if (BuildConfig.DEBUG) {
@ -294,7 +296,6 @@ open class TaskAdapter(
val newTask = CaldavTask(task.id, list)
newTask.remoteParent = caldavTask.remoteParent
caldavTask.id = caldavDao.insert(newTask)
task.caldavTask = caldavTask
} else {
caldavDao.update(caldavTask)
}

@ -6,7 +6,7 @@ import com.todoroo.astrid.data.Task
data class TaskContainer(
@Embedded val task: Task,
@Embedded var caldavTask: CaldavTask? = null,
@Embedded val caldavTask: CaldavTask? = null,
@Embedded val location: Location? = null,
val isGoogleTask: Boolean = false,
val parentComplete: Boolean = false,

Loading…
Cancel
Save