avoid extra condition containing all items
This commit is contained in:
parent
b9508b623a
commit
2345fc885d
1 changed files with 7 additions and 3 deletions
|
@ -52,9 +52,13 @@ def find(data):
|
|||
g = state.cache.get(key)
|
||||
if g is None:
|
||||
state.cache.lock(key)
|
||||
if data.get('query', {}).get('conditions'):
|
||||
items = q['qs'].options(load_only('id'))
|
||||
else:
|
||||
items = None
|
||||
qs = models.Find.query.filter_by(key=q['group'])
|
||||
if items.first():
|
||||
if items is None or items.first():
|
||||
if items is not None:
|
||||
qs = qs.filter(models.Find.item_id.in_(items))
|
||||
values = list(qs.values('value', 'findvalue', 'sortvalue'))
|
||||
for f in values:
|
||||
|
|
Loading…
Reference in a new issue