1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-28 20:39:59 +00:00

Bugfix rename author in book list

This commit is contained in:
Ozzie Isaacs 2023-06-18 10:14:53 +02:00
parent 07d97d18d0
commit e63a04093c

View File

@ -471,7 +471,7 @@ def get_sorted_entry(field, bookid):
if field == 'sort': if field == 'sort':
return json.dumps({'sort': book.title}) return json.dumps({'sort': book.title})
if field == 'author_sort': if field == 'author_sort':
return json.dumps({'author_sort': book.author}) return json.dumps({'authors': " & ".join([a.name for a in calibre_db.order_authors([book])])})
return "" return ""
@ -1250,13 +1250,14 @@ def handle_author_on_edit(book, author_name, update_stored=True):
# handle author(s) # handle author(s)
input_authors, renamed = prepare_authors(author_name) input_authors, renamed = prepare_authors(author_name)
# change |= modify_database_object(input_authors, book.authors, db.Authors, calibre_db.session, 'author')
# Search for each author if author is in database, if not, author name and sorted author name is generated new # Search for each author if author is in database, if not, author name and sorted author name is generated new
# everything then is assembled for sorted author field in database # everything then is assembled for sorted author field in database
sort_authors_list = list() sort_authors_list = list()
for inp in input_authors: for inp in input_authors:
stored_author = calibre_db.session.query(db.Authors).filter(db.Authors.name == inp).first() stored_author = calibre_db.session.query(db.Authors).filter(db.Authors.name == inp).first()
if not stored_author: if not stored_author:
stored_author = helper.get_sorted_author(inp) stored_author = helper.get_sorted_author(inp.replace('|', ','))
else: else:
stored_author = stored_author.sort stored_author = stored_author.sort
sort_authors_list.append(helper.get_sorted_author(stored_author)) sort_authors_list.append(helper.get_sorted_author(stored_author))