Ignore checklists with missing cards

This commit is contained in:
Ghassen Rjab 2017-09-26 06:58:39 +01:00
parent eb945f26a3
commit f883757552

View file

@ -398,27 +398,29 @@ export class TrelloCreator {
createChecklists(trelloChecklists) { createChecklists(trelloChecklists) {
trelloChecklists.forEach((checklist) => { trelloChecklists.forEach((checklist) => {
// Create the checklist if (this.cards[checklist.idCard]) {
const checklistToCreate = { // Create the checklist
cardId: this.cards[checklist.idCard], const checklistToCreate = {
title: checklist.name, cardId: this.cards[checklist.idCard],
createdAt: this._now(), title: checklist.name,
sort: checklist.pos, createdAt: this._now(),
}; sort: checklist.pos,
const checklistId = Checklists.direct.insert(checklistToCreate); };
// keep track of Trello id => WeKan id const checklistId = Checklists.direct.insert(checklistToCreate);
this.checklists[checklist.id] = checklistId; // keep track of Trello id => WeKan id
// Now add the items to the checklist this.checklists[checklist.id] = checklistId;
const itemsToCreate = []; // Now add the items to the checklist
checklist.checkItems.forEach((item) => { const itemsToCreate = [];
itemsToCreate.push({ checklist.checkItems.forEach((item) => {
_id: checklistId + itemsToCreate.length, itemsToCreate.push({
title: item.name, _id: checklistId + itemsToCreate.length,
isFinished: item.state === 'complete', title: item.name,
sort: item.pos, isFinished: item.state === 'complete',
sort: item.pos,
});
}); });
}); Checklists.direct.update(checklistId, {$set: {items: itemsToCreate}});
Checklists.direct.update(checklistId, {$set: {items: itemsToCreate}}); }
}); });
} }