From 68b2482ede5b6a76fe366198af728efc6ec71517 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 15 Nov 2018 11:18:26 +0000 Subject: [PATCH] avoid duplicated keys in nested queries --- pandora/clip/managers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pandora/clip/managers.py b/pandora/clip/managers.py index d69fb7c6..729624d5 100644 --- a/pandora/clip/managers.py +++ b/pandora/clip/managers.py @@ -145,7 +145,11 @@ class ClipManager(Manager): keys = layer_ids + ['annotations', 'text', '*'] conditions = data.get('query', {}).get('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', '&') def parse(condition):