Fix Trello importation for ChecklistItems

pull/1611/head
ZeBBy 7 years ago committed by GitHub
parent 3b6ec34bf5
commit e721dba1e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      models/trelloCreator.js

@ -429,17 +429,21 @@ export class TrelloCreator {
const checklistId = Checklists.direct.insert(checklistToCreate); const checklistId = Checklists.direct.insert(checklistToCreate);
// keep track of Trello id => WeKan id // keep track of Trello 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 checklistItems
var counter = 0;
const itemsToCreate = []; const itemsToCreate = [];
checklist.checkItems.forEach((item) => { checklist.checkItems.forEach((item) => {
itemsToCreate.push({ counter++;
_id: checklistId + itemsToCreate.length, const checklistItemTocreate = {
_id: checklistId + counter,
title: item.name, title: item.name,
isFinished: item.state === 'complete', checklistId: this.checklists[checklist.id],
cardId: this.cards[checklist.idCard],
sort: item.pos, sort: item.pos,
}); isFinished: item.state === 'complete',
};
ChecklistItems.direct.insert(checklistItemTocreate);
}); });
Checklists.direct.update(checklistId, {$set: {items: itemsToCreate}});
} }
}); });
} }

Loading…
Cancel
Save