Fix problem where ratings have non-string sort values

This commit is contained in:
Charles Haley 2010-12-18 17:22:26 +00:00
parent 545cdfd00d
commit 13e83afab8

View File

@ -1128,6 +1128,10 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
for l in list:
(id, val, sort_val) = (l[0], l[1], l[2])
tids[category][val] = (id, sort_val)
elif cat['datatype'] == 'rating':
for l in list:
(id, val) = (l[0], l[1])
tids[category][val] = (id, '{0:05.2f}'.format(val))
else:
for l in list:
(id, val) = (l[0], l[1])
@ -1256,12 +1260,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
# sort the list
if sort == 'name':
def get_sort_key(x):
sk = x.s
if isinstance(sk, unicode):
sk = sort_key(sk)
return sk
kf = get_sort_key
kf = lambda x :sort_key(x.s)
reverse=False
elif sort == 'popularity':
kf = lambda x: x.c