fix(migration): Trello checklists (#2140)
continuous-integration/drone/push Build is passing Details

Trello checklists are now properly converted to html checklists and put into the description.

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: #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:
Christoph Ritzer 2024-03-09 09:01:02 +00:00 committed by konrad
parent e65c3ffe6b
commit 86983f50d4
2 changed files with 13 additions and 11 deletions

View File

@ -248,17 +248,17 @@ func convertTrelloDataToVikunja(trelloData []*trello.Board, token string) (fullV
// Checklists (as markdown in description)
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 {
task.Description += "\n* "
task.Description += "\n"
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 {
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 {
log.Debugf("[Trello Migration] Converted %d checklists from card %s", len(card.Checklists), card.ID)

View File

@ -249,15 +249,17 @@ func TestConvertTrelloToVikunja(t *testing.T) {
Title: "Test Card 2",
Description: `
## Checkproject 1
<h2> Checkproject 1</h2>
* [ ] Pending Task
* [x] Completed Task
<ul data-type="taskList">
<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
* [ ] Another Pending Task`,
<ul data-type="taskList">
<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,
KanbanPosition: 124,
},