summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/trelloCreator.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/models/trelloCreator.js b/models/trelloCreator.js
index 89e48a16..8920ff77 100644
--- a/models/trelloCreator.js
+++ b/models/trelloCreator.js
@@ -429,17 +429,20 @@ export class TrelloCreator {
const checklistId = Checklists.direct.insert(checklistToCreate);
// keep track of Trello id => WeKan id
this.checklists[checklist.id] = checklistId;
- // Now add the items to the checklist
- const itemsToCreate = [];
+ // Now add the items to the checklistItems
+ let counter = 0;
checklist.checkItems.forEach((item) => {
- itemsToCreate.push({
- _id: checklistId + itemsToCreate.length,
+ counter++;
+ const checklistItemTocreate = {
+ _id: checklistId + counter,
title: item.name,
- isFinished: item.state === 'complete',
+ checklistId: this.checklists[checklist.id],
+ cardId: this.cards[checklist.idCard],
sort: item.pos,
- });
+ isFinished: item.state === 'complete',
+ };
+ ChecklistItems.direct.insert(checklistItemTocreate);
});
- Checklists.direct.update(checklistId, {$set: {items: itemsToCreate}});
}
});
}