Skip to content

Commit

Permalink
Prevent local variable 'from_book' referenced before assignment durin…
Browse files Browse the repository at this point in the history
…g merge of books

Merge books source book: Each book in own row
Merge books, sources are deleted before dialog shows up again
  • Loading branch information
OzzieIsaacs committed Mar 9, 2022
1 parent 753319c commit 3447807
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cps/editbooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1263,8 +1263,8 @@ def simulate_merge_list_book():
to_book = calibre_db.get_book(vals[0]).title
vals.pop(0)
if to_book:
from_book = []
for book_id in vals:
from_book = []
from_book.append(calibre_db.get_book(book_id).title)
return json.dumps({'to': to_book, 'from': from_book})
return ""
Expand Down
3 changes: 2 additions & 1 deletion cps/static/js/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ $(function() {
url: window.location.pathname + "/../ajax/simulatemerge",
data: JSON.stringify({"Merge_books":selections}),
success: function success(booTitles) {
$('#merge_from').empty();
$.each(booTitles.from, function(i, item) {
$("<span>- " + item + "</span>").appendTo("#merge_from");
$("<span>- " + item + "</span><p></p>").appendTo("#merge_from");
});
$("#merge_to").text("- " + booTitles.to);

Expand Down

0 comments on commit 3447807

Please sign in to comment.