From cfe8691f1a61880f763dc2c86e89f23114c6c821 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 7 Feb 2014 09:49:25 +0000 Subject: [PATCH] really fix sortClips for smart edits --- pandora/edit/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora/edit/views.py b/pandora/edit/views.py index b7a78a1e6..7292ef126 100644 --- a/pandora/edit/views.py +++ b/pandora/edit/views.py @@ -155,7 +155,8 @@ def orderClips(request): return render_to_json_response(response) actions.register(orderClips, cache=False) -def _order_clips(qs, sort): +def _order_clips(edit, sort): + qs = edit.get_clips() order_by = [] for e in sort: operator = e['operator'] @@ -169,7 +170,7 @@ def _order_clips(qs, sort): 'position': 'start', 'in': 'start', 'out': 'end', - 'text': 'annotation__sortvalue', + 'text': 'annotation__sortvalue' if edit.type == 'static' else 'annotations__sortvalue', 'item__sort__item': 'item__sort__itemId', }.get(key, key) order = '%s%s' % (operator, key) @@ -191,8 +192,7 @@ def sortClips(request): data = json.loads(request.POST['data']) edit = get_edit_or_404_json(data['edit']) response = json_response() - clips = edit.get_clips() - clips = _order_clips(clips, data['sort']) + clips = _order_clips(edit, data['sort']) response['data']['clips'] = [ox.toAZ(c['id']) for c in clips.values('id')] return render_to_json_response(response) actions.register(sortClips, cache=False)