Add support for converting checklists
This commit is contained in:
parent
3221602fdf
commit
0941b7e1dd
|
@ -102,7 +102,7 @@ func getTrelloData(token string) (trelloData []*trello.Board, err error) {
|
||||||
listMap[list.ID] = list
|
listMap[list.ID] = list
|
||||||
}
|
}
|
||||||
|
|
||||||
cards, err := board.GetCards(trello.Defaults())
|
cards, err := board.GetCards(trello.Arguments{"fields": "all"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -164,9 +164,19 @@ func convertTrelloDataToVikunja(trelloData []*trello.Board) (fullVikunjaHierachi
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checklists (as markdown in description)
|
// Checklists (as markdown in description)
|
||||||
//for _, checklist := range card.Checklists {
|
for _, checklist := range card.Checklists {
|
||||||
//
|
task.Description += "\n\n## " + checklist.Name + "\n"
|
||||||
//}
|
|
||||||
|
for _, item := range checklist.CheckItems {
|
||||||
|
task.Description += "\n* "
|
||||||
|
if item.State == "completed" {
|
||||||
|
task.Description += "[x]"
|
||||||
|
} else {
|
||||||
|
task.Description += "[ ]"
|
||||||
|
}
|
||||||
|
task.Description += " " + item.Name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Labels
|
// Labels
|
||||||
for _, label := range card.Labels {
|
for _, label := range card.Labels {
|
||||||
|
|
|
@ -75,6 +75,34 @@ func TestConvertTrelloToVikunja(t *testing.T) {
|
||||||
{
|
{
|
||||||
Name: "Test Card 2",
|
Name: "Test Card 2",
|
||||||
Pos: 124,
|
Pos: 124,
|
||||||
|
Checklists: []*trello.Checklist{
|
||||||
|
{
|
||||||
|
Name: "Checklist 1",
|
||||||
|
CheckItems: []trello.CheckItem{
|
||||||
|
{
|
||||||
|
State: "pending",
|
||||||
|
Name: "Pending Task",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
State: "completed",
|
||||||
|
Name: "Completed Task",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "Checklist 2",
|
||||||
|
CheckItems: []trello.CheckItem{
|
||||||
|
{
|
||||||
|
State: "pending",
|
||||||
|
Name: "Pending Task",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
State: "pending",
|
||||||
|
Name: "Another Pending Task",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "Test Card 3",
|
Name: "Test Card 3",
|
||||||
|
@ -205,7 +233,18 @@ func TestConvertTrelloToVikunja(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Title: "Test Card 2",
|
Title: "Test Card 2",
|
||||||
|
Description: `
|
||||||
|
|
||||||
|
## Checklist 1
|
||||||
|
|
||||||
|
* [ ] Pending Task
|
||||||
|
* [x] Completed Task
|
||||||
|
|
||||||
|
## Checklist 2
|
||||||
|
|
||||||
|
* [ ] Pending Task
|
||||||
|
* [ ] Another Pending Task`,
|
||||||
BucketID: 1,
|
BucketID: 1,
|
||||||
Position: 124,
|
Position: 124,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user