mirror of
https://github.com/wekan/wekan.git
synced 2025-04-20 12:07:11 -04:00
Ignore checklists with missing cards
This commit is contained in:
parent
eb945f26a3
commit
f883757552
1 changed files with 22 additions and 20 deletions
|
@ -398,27 +398,29 @@ export class TrelloCreator {
|
|||
|
||||
createChecklists(trelloChecklists) {
|
||||
trelloChecklists.forEach((checklist) => {
|
||||
// Create the checklist
|
||||
const checklistToCreate = {
|
||||
cardId: this.cards[checklist.idCard],
|
||||
title: checklist.name,
|
||||
createdAt: this._now(),
|
||||
sort: checklist.pos,
|
||||
};
|
||||
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 = [];
|
||||
checklist.checkItems.forEach((item) => {
|
||||
itemsToCreate.push({
|
||||
_id: checklistId + itemsToCreate.length,
|
||||
title: item.name,
|
||||
isFinished: item.state === 'complete',
|
||||
sort: item.pos,
|
||||
if (this.cards[checklist.idCard]) {
|
||||
// Create the checklist
|
||||
const checklistToCreate = {
|
||||
cardId: this.cards[checklist.idCard],
|
||||
title: checklist.name,
|
||||
createdAt: this._now(),
|
||||
sort: checklist.pos,
|
||||
};
|
||||
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 = [];
|
||||
checklist.checkItems.forEach((item) => {
|
||||
itemsToCreate.push({
|
||||
_id: checklistId + itemsToCreate.length,
|
||||
title: item.name,
|
||||
isFinished: item.state === 'complete',
|
||||
sort: item.pos,
|
||||
});
|
||||
});
|
||||
});
|
||||
Checklists.direct.update(checklistId, {$set: {items: itemsToCreate}});
|
||||
Checklists.direct.update(checklistId, {$set: {items: itemsToCreate}});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue