Don't add a subtask to the top level of tasks to not add it twice in the list

This commit is contained in:
kolaente 2020-08-17 22:30:24 +02:00
parent 28fd0e91ee
commit c517a87b85
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 12 additions and 7 deletions

View File

@ -313,6 +313,18 @@ func convertTodoistToVikunja(sync *sync) (fullVikunjaHierachie []*models.Namespa
}
tasks[i.ParentID].RelatedTasks[models.RelationKindSubtask] = append(tasks[i.ParentID].RelatedTasks[models.RelationKindSubtask], tasks[i.ID])
// Remove the task from the top level structure, otherwise it is added twice
outer:
for _, list := range lists {
for in, t := range list.Tasks {
if t == tasks[i.ID] {
list.Tasks = append(list.Tasks[:in], list.Tasks[in+1:]...)
break outer
}
}
}
delete(tasks, i.ID)
}
// Task Notes -> Task Descriptions

View File

@ -413,13 +413,6 @@ func TestConvertTodoistToVikunja(t *testing.T) {
},
},
},
{
Title: "Task with parent",
Done: false,
Priority: 2,
Created: time1,
DoneAt: nilTime,
},
{
Title: "Task400000106",
Done: true,