mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
newdb: Allow sorting on ids
Fix regression that broke calibredb catalog when sorting on the id field. Fixes #1216090 [calibredb catalog fails on sort_key - KeyError: 'id'](https://bugs.launchpad.net/calibre/+bug/1216090)
This commit is contained in:
parent
c5472fe489
commit
4daace5860
@ -820,8 +820,11 @@ class Cache(object):
|
||||
ans = self.fields[fm.get(field, field)].sort_keys_for_books(
|
||||
get_metadata, lang_map, all_book_ids)
|
||||
except KeyError:
|
||||
ans = virtual_fields[fm.get(field, field)].sort_keys_for_books(
|
||||
get_metadata, lang_map, all_book_ids)
|
||||
if field == 'id':
|
||||
ans = {bid:bid for bid in ids_to_sort}
|
||||
else:
|
||||
ans = virtual_fields[fm.get(field, field)].sort_keys_for_books(
|
||||
get_metadata, lang_map, all_book_ids)
|
||||
if is_series:
|
||||
idx_ans = self.fields[idx].sort_keys_for_books(
|
||||
get_metadata, lang_map, all_book_ids)
|
||||
|
Loading…
x
Reference in New Issue
Block a user