slightly faster filter update

This commit is contained in:
j 2016-01-27 14:25:36 +05:30
parent e27e429fd6
commit 62c0c9337f

View file

@ -460,8 +460,7 @@ def migrate_10():
from item.person import get_sort_name
import unicodedata
sort_names = {}
for f in Find.query.filter(Find.key.in_(Item.sort_keys)):
if f.key in Item.filter_keys:
for f in Find.query.filter(Find.key.in_(Item.filter_keys)):
sort_type = get_by_id(settings.config['itemKeys'], f.key).get('sortType')
if sort_type == 'person':
if f.value in sort_names:
@ -474,8 +473,6 @@ def migrate_10():
f.sortvalue = unicodedata.normalize('NFKD', f.sortvalue).lower()
else:
f.sortvalue = None
else:
f.sortvalue = None
session.add(f)
session.commit()
return 10