Ignore relationship loops created remotely

pull/3373/head
Alex Baker 9 months ago
parent 32c4fe2511
commit cafe3abf23

@ -183,6 +183,21 @@ class GoogleTaskDaoTests : InjectingTestCase() {
assertEquals("abcd", googleTaskDao.getByTaskId(1)!!.remoteParent)
}
@Test
fun ignoreSelfParent() = runBlocking {
insert(
newCaldavTask(
with(TASK, 1),
with(REMOTE_ID, "123"),
with(REMOTE_PARENT, "123")
)
)
caldavDao.updateParents()
assertEquals(0, taskDao.fetch(1)!!.parent)
}
@Test
fun updateParents() = runBlocking {
insert(newCaldavTask(with(TASK, 1), with(REMOTE_ID, "123")))

@ -296,7 +296,7 @@ GROUP BY caldav_lists.cdl_uuid
)
UPDATE tasks
SET parent = IFNULL(
(SELECT parent_id FROM parent_map WHERE task_id = tasks._id),
(SELECT parent_id FROM parent_map WHERE task_id = tasks._id AND tasks._id != parent_id),
0
)
WHERE _id IN (

Loading…
Cancel
Save