avoid duplicated keys in nested queries

This commit is contained in:
j 2018-11-15 11:18:26 +00:00
parent 83765d91d8
commit 68b2482ede

View file

@ -145,7 +145,11 @@ class ClipManager(Manager):
keys = layer_ids + ['annotations', 'text', '*'] keys = layer_ids + ['annotations', 'text', '*']
conditions = data.get('query', {}).get('conditions', []) conditions = data.get('query', {}).get('conditions', [])
conditions = flatten_conditions(conditions) conditions = flatten_conditions(conditions)
conditions = list(filter(lambda c: c.get('key') in keys, conditions)) conditions_ = []
for c in conditions:
if c.get('key') in keys and c not in conditions_:
conditions_.append(c)
conditions = conditions_
operator = data.get('query', {}).get('operator', '&') operator = data.get('query', {}).get('operator', '&')
def parse(condition): def parse(condition):