1
0

fix(migration): make sub project hierarchy work when importing from other services

This commit is contained in:
kolaente
2023-11-08 22:56:10 +01:00
parent 8acc42cb0b
commit 707bb6f89e
8 changed files with 518 additions and 485 deletions

View File

@ -166,12 +166,13 @@ func convertTrelloDataToVikunja(trelloData []*trello.Board, token string) (fullV
log.Debugf("[Trello Migration] ")
var pseudoParentID int64 = 1
fullVikunjaHierachie = []*models.ProjectWithTasksAndBuckets{
{
Project: models.Project{
ID: pseudoParentID,
Title: "Imported from Trello",
},
ChildProjects: []*models.ProjectWithTasksAndBuckets{},
},
}
@ -179,12 +180,14 @@ func convertTrelloDataToVikunja(trelloData []*trello.Board, token string) (fullV
log.Debugf("[Trello Migration] Converting %d boards to vikunja projects", len(trelloData))
for _, board := range trelloData {
for index, board := range trelloData {
project := &models.ProjectWithTasksAndBuckets{
Project: models.Project{
Title: board.Name,
Description: board.Desc,
IsArchived: board.Closed,
ID: int64(index+1) + pseudoParentID,
ParentProjectID: pseudoParentID,
Title: board.Name,
Description: board.Desc,
IsArchived: board.Closed,
},
}
@ -300,7 +303,7 @@ func convertTrelloDataToVikunja(trelloData []*trello.Board, token string) (fullV
log.Debugf("[Trello Migration] Converted all cards to tasks for board %s", board.ID)
fullVikunjaHierachie[0].ChildProjects = append(fullVikunjaHierachie[0].ChildProjects, project)
fullVikunjaHierachie = append(fullVikunjaHierachie, project)
}
return