mirror of
https://github.com/wekan/wekan.git
synced 2026-01-06 17:48:49 +01:00
ReactiveMiniMongoIndex, added getChecklistItemsWithChecklistId
This commit is contained in:
parent
f80ecded0a
commit
316acd0366
2 changed files with 24 additions and 7 deletions
|
|
@ -1129,6 +1129,28 @@ ReactiveMiniMongoIndex = {
|
|||
}
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
getChecklistItemsWithChecklistId(checklistId, addSelect = {}, options) {
|
||||
let ret = []
|
||||
if (checklistId) {
|
||||
const select = {addSelect, options}
|
||||
if (!this.__checklistItemsWithId) {
|
||||
this.__checklistItemsWithId = new DataCache(_select => {
|
||||
const __select = Jsons.parse(_select);
|
||||
const _checklistItems = ReactiveCache.getChecklistItems(
|
||||
{ checklistId: { $exists: true },
|
||||
...__select.addSelect,
|
||||
}, __select.options);
|
||||
const _ret = _.groupBy(_checklistItems, 'checklistId')
|
||||
return _ret;
|
||||
});
|
||||
}
|
||||
ret = this.__checklistItemsWithId.get(Jsons.stringify(select));
|
||||
if (ret) {
|
||||
ret = ret[checklistId] || [];
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
import { ReactiveCache, ReactiveMiniMongoIndex } from '/imports/reactiveCache';
|
||||
|
||||
Checklists = new Mongo.Collection('checklists');
|
||||
|
||||
|
|
@ -87,12 +87,7 @@ Checklists.helpers({
|
|||
return ret;
|
||||
},
|
||||
items() {
|
||||
const ret = ReactiveCache.getChecklistItems(
|
||||
{
|
||||
checklistId: this._id,
|
||||
},
|
||||
{ sort: ['sort'] },
|
||||
);
|
||||
const ret = ReactiveMiniMongoIndex.getChecklistItemsWithChecklistId(this._id, {}, { sort: ['sort'] });
|
||||
return ret;
|
||||
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue