Don't add a subtask to the top level of tasks to not add it twice in the list
This commit is contained in:
parent
28fd0e91ee
commit
c517a87b85
2 changed files with 12 additions and 7 deletions
|
@ -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])
|
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
|
// Task Notes -> Task Descriptions
|
||||||
|
|
|
@ -413,13 +413,6 @@ func TestConvertTodoistToVikunja(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Title: "Task with parent",
|
|
||||||
Done: false,
|
|
||||||
Priority: 2,
|
|
||||||
Created: time1,
|
|
||||||
DoneAt: nilTime,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
Title: "Task400000106",
|
Title: "Task400000106",
|
||||||
Done: true,
|
Done: true,
|
||||||
|
|
Loading…
Reference in a new issue