mirror of
https://github.com/wekan/wekan.git
synced 2025-04-24 14:08:31 -04:00
Import sort attribute of checklists and its items from Wekan
If no sort was found (Old format), we use checklist or checklist item index in the array instead
This commit is contained in:
parent
5ef24437a3
commit
2f69e65dc0
1 changed files with 4 additions and 2 deletions
|
@ -410,23 +410,25 @@ export class WekanCreator {
|
|||
}
|
||||
|
||||
createChecklists(wekanChecklists) {
|
||||
wekanChecklists.forEach((checklist) => {
|
||||
wekanChecklists.forEach((checklist, checklistIndex) => {
|
||||
// Create the checklist
|
||||
const checklistToCreate = {
|
||||
cardId: this.cards[checklist.cardId],
|
||||
title: checklist.title,
|
||||
createdAt: checklist.createdAt,
|
||||
sort: checklist.sort ? checklist.sort : checklistIndex,
|
||||
};
|
||||
const checklistId = Checklists.direct.insert(checklistToCreate);
|
||||
// keep track of Wekan id => WeKan id
|
||||
this.checklists[checklist._id] = checklistId;
|
||||
// Now add the items to the checklist
|
||||
const itemsToCreate = [];
|
||||
checklist.items.forEach((item) => {
|
||||
checklist.items.forEach((item, itemIndex) => {
|
||||
itemsToCreate.push({
|
||||
_id: checklistId + itemsToCreate.length,
|
||||
title: item.title,
|
||||
isFinished: item.isFinished,
|
||||
sort: item.sort ? item.sort : itemIndex,
|
||||
});
|
||||
});
|
||||
Checklists.direct.update(checklistId, {$set: {items: itemsToCreate}});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue