mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
ReactiveMiniMongoIndex, added getChecklistsWithCardId
This commit is contained in:
parent
40a5422e75
commit
f80ecded0a
2 changed files with 23 additions and 1 deletions
|
|
@ -1107,6 +1107,28 @@ ReactiveMiniMongoIndex = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
},
|
||||||
|
getChecklistsWithCardId(cardId, addSelect = {}, options) {
|
||||||
|
let ret = []
|
||||||
|
if (cardId) {
|
||||||
|
const select = {addSelect, options}
|
||||||
|
if (!this.__checklistsWithId) {
|
||||||
|
this.__checklistsWithId = new DataCache(_select => {
|
||||||
|
const __select = Jsons.parse(_select);
|
||||||
|
const _checklists = ReactiveCache.getChecklists(
|
||||||
|
{ cardId: { $exists: true },
|
||||||
|
...__select.addSelect,
|
||||||
|
}, __select.options);
|
||||||
|
const _ret = _.groupBy(_checklists, 'cardId')
|
||||||
|
return _ret;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
ret = this.__checklistsWithId.get(Jsons.stringify(select));
|
||||||
|
if (ret) {
|
||||||
|
ret = ret[cardId] || [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -809,7 +809,7 @@ Cards.helpers({
|
||||||
},
|
},
|
||||||
|
|
||||||
checklists() {
|
checklists() {
|
||||||
const ret = ReactiveCache.getChecklists({ cardId: this.getRealId() }, { sort: { sort: 1 } });
|
const ret = ReactiveMiniMongoIndex.getChecklistsWithCardId(this.getRealId(), {}, { sort: { sort: 1 } });
|
||||||
return ret;
|
return ret;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue