From ba12b53e49852e92c6ed77df07f7576a9ed2b02c Mon Sep 17 00:00:00 2001 From: IgnatzHome Date: Sat, 19 May 2018 20:53:25 +0200 Subject: correct way, wrong idea --- .eslintrc.json | 2 +- client/lib/filter.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 255e00ba..06d3f001 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -32,7 +32,7 @@ "comma-spacing": 2, "comma-style": 2, "eol-last": 2, - "linebreak-style": [2, "unix"], + "linebreak-style": [2, "windows"], "new-parens": 2, "no-lonely-if": 2, "no-multiple-empty-lines": 2, diff --git a/client/lib/filter.js b/client/lib/filter.js index 4a6dd2f3..749527fb 100644 --- a/client/lib/filter.js +++ b/client/lib/filter.js @@ -143,6 +143,11 @@ class AdvancedFilter { return commands; } + _fieldNameToId(name) + { + CustomFields.find({name})._id; + } + _arrayToSelector(commands) { try { @@ -159,7 +164,7 @@ class AdvancedFilter { { const field = commands[i-1].cmd; const str = commands[i+1].cmd; - commands[i] = {[field]:str}; + commands[i] = {'customFields._id':this._fieldNameToId(field), 'customFields.value':str}; commands.splice(i-1, 1); commands.splice(i, 1); //changed = true; @@ -207,7 +212,7 @@ Filter = { isActive() { return _.any(this._fields, (fieldName) => { return this[fieldName]._isActive(); - }); + }) || this.advanced._isActive(); }, _getMongoSelector() { -- cgit v1.2.3-1-g7c22