Fix for #2445 (book read status can't be set if custom column is linked and read status was set before)

This commit is contained in:
Ozzie Isaacs 2022-06-11 11:35:02 +02:00
parent 78b45f716a
commit 89d522e389

View File

@ -322,12 +322,12 @@ def edit_book_read_status(book_id, read_status=None):
try:
calibre_db.update_title_sort(config)
book = calibre_db.get_filtered_book(book_id)
read_status = getattr(book, 'custom_column_' + str(config.config_read_column))
if len(read_status):
book_read_status = getattr(book, 'custom_column_' + str(config.config_read_column))
if len(book_read_status):
if read_status is None:
read_status[0].value = not read_status[0].value
book_read_status[0].value = not book_read_status[0].value
else:
read_status[0].value = read_status is True
book_read_status[0].value = read_status is True
calibre_db.session.commit()
else:
cc_class = db.cc_classes[config.config_read_column]