summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorGhassen Rjab <rjab.ghassen@gmail.com>2017-09-16 19:59:03 +0100
committerGhassen Rjab <rjab.ghassen@gmail.com>2017-09-16 19:59:03 +0100
commit2f69e65dc0c5de0ae7d39728ab0e1c7132733720 (patch)
tree5dcaaf660de8506290406aefa74d676163bb8b9c /models
parent5ef24437a3045516da5955acac124bc2440aa703 (diff)
downloadwekan-2f69e65dc0c5de0ae7d39728ab0e1c7132733720.tar.gz
wekan-2f69e65dc0c5de0ae7d39728ab0e1c7132733720.tar.bz2
wekan-2f69e65dc0c5de0ae7d39728ab0e1c7132733720.zip
Import sort attribute of checklists and its items from Wekan
If no sort was found (Old format), we use checklist or checklist item index in the array instead
Diffstat (limited to 'models')
-rw-r--r--models/wekanCreator.js6
1 files changed, 4 insertions, 2 deletions
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}});