|
@@ -410,23 +410,25 @@ export class WekanCreator {
|
|
}
|
|
}
|
|
|
|
|
|
createChecklists(wekanChecklists) {
|
|
createChecklists(wekanChecklists) {
|
|
- wekanChecklists.forEach((checklist) => {
|
|
|
|
|
|
+ wekanChecklists.forEach((checklist, checklistIndex) => {
|
|
// Create the checklist
|
|
// Create the checklist
|
|
const checklistToCreate = {
|
|
const checklistToCreate = {
|
|
cardId: this.cards[checklist.cardId],
|
|
cardId: this.cards[checklist.cardId],
|
|
title: checklist.title,
|
|
title: checklist.title,
|
|
createdAt: checklist.createdAt,
|
|
createdAt: checklist.createdAt,
|
|
|
|
+ sort: checklist.sort ? checklist.sort : checklistIndex,
|
|
};
|
|
};
|
|
const checklistId = Checklists.direct.insert(checklistToCreate);
|
|
const checklistId = Checklists.direct.insert(checklistToCreate);
|
|
// keep track of Wekan id => WeKan id
|
|
// keep track of Wekan id => WeKan id
|
|
this.checklists[checklist._id] = checklistId;
|
|
this.checklists[checklist._id] = checklistId;
|
|
// Now add the items to the checklist
|
|
// Now add the items to the checklist
|
|
const itemsToCreate = [];
|
|
const itemsToCreate = [];
|
|
- checklist.items.forEach((item) => {
|
|
|
|
|
|
+ checklist.items.forEach((item, itemIndex) => {
|
|
itemsToCreate.push({
|
|
itemsToCreate.push({
|
|
_id: checklistId + itemsToCreate.length,
|
|
_id: checklistId + itemsToCreate.length,
|
|
title: item.title,
|
|
title: item.title,
|
|
isFinished: item.isFinished,
|
|
isFinished: item.isFinished,
|
|
|
|
+ sort: item.sort ? item.sort : itemIndex,
|
|
});
|
|
});
|
|
});
|
|
});
|
|
Checklists.direct.update(checklistId, {$set: {items: itemsToCreate}});
|
|
Checklists.direct.update(checklistId, {$set: {items: itemsToCreate}});
|