fix(migration): make sure trello checklists are properly imported

This commit is contained in:
kolaente 2023-02-24 12:13:18 +01:00
parent ca6d1946da
commit 168287923f
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 20 additions and 2 deletions

View File

@ -133,6 +133,24 @@ func getTrelloData(token string) (trelloData []*trello.Board, err error) {
return nil, err
}
if len(card.IDCheckLists) > 0 {
for _, checkListID := range card.IDCheckLists {
checklist, err := client.GetChecklist(checkListID, allArg)
if err != nil {
return nil, err
}
checklist.CheckItems = []trello.CheckItem{}
err = client.Get("checklists/"+checkListID+"/checkItems", allArg, &checklist.CheckItems)
if err != nil {
return nil, err
}
card.Checklists = append(card.Checklists, checklist)
log.Debugf("Retrieved checklist %s for card %s", checkListID, card.ID)
}
}
list.Cards = append(list.Cards, card)
}
@ -214,7 +232,7 @@ func convertTrelloDataToVikunja(trelloData []*trello.Board, token string) (fullV
for _, item := range checklist.CheckItems {
task.Description += "\n* "
if item.State == "completed" {
if item.State == "complete" {
task.Description += "[x]"
} else {
task.Description += "[ ]"

View File

@ -86,7 +86,7 @@ func TestConvertTrelloToVikunja(t *testing.T) {
Name: "Pending Task",
},
{
State: "completed",
State: "complete",
Name: "Completed Task",
},
},