summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2017-09-17 06:55:02 +0300
committerLauri Ojansivu <x@xet7.org>2017-09-17 06:55:02 +0300
commitcf8e1da383ce204ed5d4af15219f708c5af3d82e (patch)
tree91da10f99ac527704a1488daddac65637e652627 /models
parent5ef24437a3045516da5955acac124bc2440aa703 (diff)
parenteb55b978aa27991055db46b4883f8cb5481aaebc (diff)
downloadwekan-cf8e1da383ce204ed5d4af15219f708c5af3d82e.tar.gz
wekan-cf8e1da383ce204ed5d4af15219f708c5af3d82e.tar.bz2
wekan-cf8e1da383ce204ed5d4af15219f708c5af3d82e.zip
Merge branch 'GhassenRjab-feature/import-checklist-sort' into devel
Import checklist sort attributes from Wekan and Trello. Thanks to GhassenRjab ! Related #876
Diffstat (limited to 'models')
-rw-r--r--models/trelloCreator.js2
-rw-r--r--models/wekanCreator.js6
2 files changed, 6 insertions, 2 deletions
diff --git a/models/trelloCreator.js b/models/trelloCreator.js
index b296efdf..e7f98e85 100644
--- a/models/trelloCreator.js
+++ b/models/trelloCreator.js
@@ -403,6 +403,7 @@ export class TrelloCreator {
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
@@ -414,6 +415,7 @@ export class TrelloCreator {
_id: checklistId + itemsToCreate.length,
title: item.name,
isFinished: item.state === 'complete',
+ sort: item.pos,
});
});
Checklists.direct.update(checklistId, {$set: {items: itemsToCreate}});
diff --git a/models/wekanCreator.js b/models/wekanCreator.js
index 9c7f50ec..3cd65fd7 100644
--- a/models/wekanCreator.js
+++ b/models/wekanCreator.js
@@ -410,23 +410,25 @@ export class WekanCreator {
}
createChecklists(wekanChecklists) {
- wekanChecklists.forEach((checklist) => {
+ wekanChecklists.forEach((checklist, checklistIndex) => {
// Create the checklist
const checklistToCreate = {
cardId: this.cards[checklist.cardId],
title: checklist.title,
createdAt: checklist.createdAt,
+ sort: checklist.sort ? checklist.sort : checklistIndex,
};
const checklistId = Checklists.direct.insert(checklistToCreate);
// keep track of Wekan id => WeKan id
this.checklists[checklist._id] = checklistId;
// Now add the items to the checklist
const itemsToCreate = [];
- checklist.items.forEach((item) => {
+ checklist.items.forEach((item, itemIndex) => {
itemsToCreate.push({
_id: checklistId + itemsToCreate.length,
title: item.title,
isFinished: item.isFinished,
+ sort: item.sort ? item.sort : itemIndex,
});
});
Checklists.direct.update(checklistId, {$set: {items: itemsToCreate}});