some improvements in parseFind
This commit is contained in:
parent
9a288a3fd8
commit
2633b3d738
1 changed files with 4 additions and 3 deletions
|
@ -2,7 +2,8 @@
|
||||||
pandora.Query = (function() {
|
pandora.Query = (function() {
|
||||||
|
|
||||||
function parseFind2(str) {
|
function parseFind2(str) {
|
||||||
// takes a string, returns useful information about the application's state
|
// takes a find query string, returns useful information about the application's state
|
||||||
|
// (selected lists, find input key/value, group queries and selection, query object)
|
||||||
Ox.print('parseFind2', str)
|
Ox.print('parseFind2', str)
|
||||||
str = str || '';
|
str = str || '';
|
||||||
var conditions,
|
var conditions,
|
||||||
|
@ -48,9 +49,9 @@ pandora.Query = (function() {
|
||||||
if (ret.query.operator == '|') {
|
if (ret.query.operator == '|') {
|
||||||
ret.find = {key: 'advanced', value: ''};
|
ret.find = {key: 'advanced', value: ''};
|
||||||
} else {
|
} else {
|
||||||
var conditions = Ox.map(pandora.site.findKeys, function(findKey) {
|
conditions = Ox.map(pandora.site.findKeys, function(findKey) {
|
||||||
var values = oneCondition(ret.query.conditions, findKey.id, '');
|
var values = oneCondition(ret.query.conditions, findKey.id, '');
|
||||||
return values.length ? {key: findKey.id, values: values[0]} : null;
|
return values.length ? {key: findKey.id, values: values} : null;
|
||||||
});
|
});
|
||||||
ret.find = conditions.length == 0 ? {key: '', value: ''}
|
ret.find = conditions.length == 0 ? {key: '', value: ''}
|
||||||
: conditions.length == 1 && conditions[0].values.length == 1
|
: conditions.length == 1 && conditions[0].values.length == 1
|
||||||
|
|
Loading…
Reference in a new issue