slightly faster filter update
This commit is contained in:
parent
e27e429fd6
commit
62c0c9337f
1 changed files with 10 additions and 13 deletions
|
@ -460,20 +460,17 @@ 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:
|
||||
sort_type = get_by_id(settings.config['itemKeys'], f.key).get('sortType')
|
||||
if sort_type == 'person':
|
||||
if f.value in sort_names:
|
||||
f.sortvalue = sort_names[f.value]
|
||||
else:
|
||||
f.sortvalue = sort_names[f.value] = get_sort_name(f.value)
|
||||
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:
|
||||
f.sortvalue = sort_names[f.value]
|
||||
else:
|
||||
f.sortvalue = f.value
|
||||
if f.sortvalue:
|
||||
f.sortvalue = unicodedata.normalize('NFKD', f.sortvalue).lower()
|
||||
else:
|
||||
f.sortvalue = None
|
||||
f.sortvalue = sort_names[f.value] = get_sort_name(f.value)
|
||||
else:
|
||||
f.sortvalue = f.value
|
||||
if f.sortvalue:
|
||||
f.sortvalue = unicodedata.normalize('NFKD', f.sortvalue).lower()
|
||||
else:
|
||||
f.sortvalue = None
|
||||
session.add(f)
|
||||
|
|
Loading…
Reference in a new issue