diff options
author | IgnatzHome <ignatz@maschath.de> | 2018-05-19 16:06:06 +0200 |
---|---|---|
committer | IgnatzHome <ignatz@maschath.de> | 2018-05-19 16:06:06 +0200 |
commit | bc0aef3332ff220c7e3cba640bda69bd72567bfd (patch) | |
tree | d6071b343d5953427a239961ecafd0c0f9bfc41c /client/lib | |
parent | f6d19d2833b322eb54762dae7a8d51d07718ef24 (diff) | |
download | wekan-bc0aef3332ff220c7e3cba640bda69bd72567bfd.tar.gz wekan-bc0aef3332ff220c7e3cba640bda69bd72567bfd.tar.bz2 wekan-bc0aef3332ff220c7e3cba640bda69bd72567bfd.zip |
More Filter Corrections (Custom Fields)
Diffstat (limited to 'client/lib')
-rw-r--r-- | client/lib/filter.js | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/client/lib/filter.js b/client/lib/filter.js index ecc95d40..80793db2 100644 --- a/client/lib/filter.js +++ b/client/lib/filter.js @@ -11,7 +11,7 @@ function showFilterSidebar() { // Use a "set" filter for a field that is a set of documents uniquely // identified. For instance `{ labels: ['labelA', 'labelC', 'labelD'] }`. // use "subField" for searching inside object Fields. -// For instance '{ customFields: [{_id : { $in: ['field1']}}]} (subField would be: _id) +// For instance '{ 'customFields._id': ['field1','field2']} (subField would be: _id) class SetFilter { constructor(subField = '') { this._dep = new Tracker.Dependency(); @@ -64,21 +64,7 @@ class SetFilter { _getMongoSelector() { this._dep.depend(); - if (this.subField !== '') - { - - const selector = []; - this._selectedElements.forEach((element) => { - const item = []; - item[this.subField] = {$in: [element]}; - selector.push(item); - }); - return {$in: selector}; - } - else - { - return { $in: this._selectedElements }; - } + return { $in: this._selectedElements }; } _getEmptySelector() { @@ -128,6 +114,7 @@ Filter = { let includeEmptySelectors = false; this._fields.forEach((fieldName) => { const filter = this[fieldName]; + if (filter.subField !== '') fieldName = `${fieldName}.${filter.subField}`; if (filter._isActive()) { filterSelector[fieldName] = filter._getMongoSelector(); emptySelector[fieldName] = filter._getEmptySelector(); |