correct way, wrong idea

This commit is contained in:
IgnatzHome 2018-05-19 20:53:25 +02:00
parent b9ead144fb
commit ba12b53e49
2 changed files with 8 additions and 3 deletions

View file

@ -32,7 +32,7 @@
"comma-spacing": 2, "comma-spacing": 2,
"comma-style": 2, "comma-style": 2,
"eol-last": 2, "eol-last": 2,
"linebreak-style": [2, "unix"], "linebreak-style": [2, "windows"],
"new-parens": 2, "new-parens": 2,
"no-lonely-if": 2, "no-lonely-if": 2,
"no-multiple-empty-lines": 2, "no-multiple-empty-lines": 2,

View file

@ -143,6 +143,11 @@ class AdvancedFilter {
return commands; return commands;
} }
_fieldNameToId(name)
{
CustomFields.find({name})._id;
}
_arrayToSelector(commands) _arrayToSelector(commands)
{ {
try { try {
@ -159,7 +164,7 @@ class AdvancedFilter {
{ {
const field = commands[i-1].cmd; const field = commands[i-1].cmd;
const str = 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, 1);
commands.splice(i, 1); commands.splice(i, 1);
//changed = true; //changed = true;
@ -207,7 +212,7 @@ Filter = {
isActive() { isActive() {
return _.any(this._fields, (fieldName) => { return _.any(this._fields, (fieldName) => {
return this[fieldName]._isActive(); return this[fieldName]._isActive();
}); }) || this.advanced._isActive();
}, },
_getMongoSelector() { _getMongoSelector() {