fix(migration): Trello checklists (#2140)
Trello checklists are now properly converted to html checklists and put into the description. Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/vikunja/pulls/2140 Reviewed-by: konrad <k@knt.li> Co-authored-by: Christoph Ritzer <chris@cloumail.at> Co-committed-by: Christoph Ritzer <chris@cloumail.at>
This commit is contained in:
parent
e65c3ffe6b
commit
86983f50d4
@ -248,17 +248,17 @@ func convertTrelloDataToVikunja(trelloData []*trello.Board, token string) (fullV
|
|||||||
|
|
||||||
// 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"
|
task.Description += "\n\n<h2> " + checklist.Name + "</h2>\n\n" + `<ul data-type="taskList">`
|
||||||
|
|
||||||
for _, item := range checklist.CheckItems {
|
for _, item := range checklist.CheckItems {
|
||||||
task.Description += "\n* "
|
task.Description += "\n"
|
||||||
if item.State == "complete" {
|
if item.State == "complete" {
|
||||||
task.Description += "[x]"
|
task.Description += `<li data-checked="true" data-type="taskItem"><label><input type="checkbox" checked="checked"><span></span></label><div><p>` + item.Name + `</p></div></li>`
|
||||||
} else {
|
} else {
|
||||||
task.Description += "[ ]"
|
task.Description += `<li data-checked="false" data-type="taskItem"><label><input type="checkbox"><span></span></label><div><p>` + item.Name + `</p></div></li>`
|
||||||
}
|
}
|
||||||
task.Description += " " + item.Name
|
|
||||||
}
|
}
|
||||||
|
task.Description += "</ul>"
|
||||||
}
|
}
|
||||||
if len(card.Checklists) > 0 {
|
if len(card.Checklists) > 0 {
|
||||||
log.Debugf("[Trello Migration] Converted %d checklists from card %s", len(card.Checklists), card.ID)
|
log.Debugf("[Trello Migration] Converted %d checklists from card %s", len(card.Checklists), card.ID)
|
||||||
|
@ -249,15 +249,17 @@ func TestConvertTrelloToVikunja(t *testing.T) {
|
|||||||
Title: "Test Card 2",
|
Title: "Test Card 2",
|
||||||
Description: `
|
Description: `
|
||||||
|
|
||||||
## Checkproject 1
|
<h2> Checkproject 1</h2>
|
||||||
|
|
||||||
* [ ] Pending Task
|
<ul data-type="taskList">
|
||||||
* [x] Completed Task
|
<li data-checked="false" data-type="taskItem"><label><input type="checkbox"><span></span></label><div><p>Pending Task</p></div></li>
|
||||||
|
<li data-checked="true" data-type="taskItem"><label><input type="checkbox" checked="checked"><span></span></label><div><p>Completed Task</p></div></li></ul>
|
||||||
|
|
||||||
## Checkproject 2
|
<h2> Checkproject 2</h2>
|
||||||
|
|
||||||
* [ ] Pending Task
|
<ul data-type="taskList">
|
||||||
* [ ] Another Pending Task`,
|
<li data-checked="false" data-type="taskItem"><label><input type="checkbox"><span></span></label><div><p>Pending Task</p></div></li>
|
||||||
|
<li data-checked="false" data-type="taskItem"><label><input type="checkbox"><span></span></label><div><p>Another Pending Task</p></div></li></ul>`,
|
||||||
BucketID: 1,
|
BucketID: 1,
|
||||||
KanbanPosition: 124,
|
KanbanPosition: 124,
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user