From 168287923fd98c7fa6ddf64ad07aed20a85cb0a1 Mon Sep 17 00:00:00 2001 From: kolaente Date: Fri, 24 Feb 2023 12:13:18 +0100 Subject: [PATCH] fix(migration): make sure trello checklists are properly imported --- pkg/modules/migration/trello/trello.go | 20 +++++++++++++++++++- pkg/modules/migration/trello/trello_test.go | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/pkg/modules/migration/trello/trello.go b/pkg/modules/migration/trello/trello.go index c443d3c6c..af0afad9c 100644 --- a/pkg/modules/migration/trello/trello.go +++ b/pkg/modules/migration/trello/trello.go @@ -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 += "[ ]" diff --git a/pkg/modules/migration/trello/trello_test.go b/pkg/modules/migration/trello/trello_test.go index 3be909f5f..1d0ff0062 100644 --- a/pkg/modules/migration/trello/trello_test.go +++ b/pkg/modules/migration/trello/trello_test.go @@ -86,7 +86,7 @@ func TestConvertTrelloToVikunja(t *testing.T) { Name: "Pending Task", }, { - State: "completed", + State: "complete", Name: "Completed Task", }, },