perfs: use a dictionary to create sorted list of formdatas (#35437)

This commit is contained in:
Frédéric Péters 2019-08-19 10:55:22 +02:00
parent 0eeebc6573
commit 5626fc643f
1 changed files with 2 additions and 5 deletions

View File

@ -166,11 +166,8 @@ class FormDefUI(object):
order_by = None
if order_by and not anonymise:
ordered_ids = formdata_class.get_sorted_ids(order_by)
new_item_ids = []
for item_id in ordered_ids:
if item_id in item_ids:
new_item_ids.append(item_id)
item_ids = new_item_ids
item_ids_dict = {x: True for x in item_ids}
item_ids = [x for x in ordered_ids if x in item_ids_dict]
else:
item_ids.sort(lambda x,y: cmp(int(x), int(y)))
item_ids.reverse()