Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for editing Authors and adds Typeahead for Author input #5

Merged
merged 7 commits into from
Apr 3, 2016

Conversation

cervinko
Copy link
Collaborator

I had a lot of Authors 'Unbekannt' in my library. When i entered a Author in the Web interface all 'Unbekannt' where edited. With this fix a new Author is added to the db and linked to the book.
It would be better to use gettext instead of if book.authors[0].name not in ("Unknown", "Unbekannt", "", " "): but that seemed to complex for me.

Added Typeahead for Author input

thats my first github pull request. i wanted to seperate it in two parts; didn't work.

@cervinko cervinko changed the title Fixes for editing Authors Fixes for editing Authors and adds Typeahead for Author input Mar 28, 2016
@janeczku
Copy link
Owner

Great PR, thanks! Will have a look at it soon!

@janeczku
Copy link
Owner

janeczku commented Apr 2, 2016

Just had a quick look. Two problems came up:

  1. Given the current author name is "Rolf Schmidt" and i correct the spelling to "Rolf Schmid" then the change is not applied.
  2. Given the current author name is "John Doe" and i correct the name to "Jane Doe" then "John Doe" remains in the authors table even though there is no book associated with it.

@cervinko
Copy link
Collaborator Author

cervinko commented Apr 2, 2016

Thank you for the feedback. Unfortunatelly i can not reproduce your first bug. Did you look up the metadatachanges in the Authors List page? Because this one uses the 'sort' column of the authors table and this column is not edited by calibre-web at all. (but it clearly should be one day)

If you change 'John Doe' to 'Jane Doe' and 'Jane Doe' and Jane Doe is already an entry in the db, then this entry get appended to the book and the wrong John Doe stays in the db. I will add a check if John Doe is orphaned.
If 'Jane Doe' is a new entry then the entry for 'John Doe' is changed to 'Jane Doe'. So the change applies to all books.

Maybe its not the best solution. But i can not think of a better one. And i think it's better than the current one.


author_id = book.authors[0].id

is_author = db.session.query(db.Authors).filter(db.Authors.name.like('%' + to_save["author_name"].strip() + '%')).first()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you doing a wildcard match of the author name?
The wildcard will match to_save["author_name"]="Rolf Schmid" with an existing author "Rolf Schmidt". Thats why the book author doesn't get changed in that case as i previously commented.
It should be an equal operator here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx!. changed it to equal operator

@janeczku
Copy link
Owner

janeczku commented Apr 3, 2016

Nice. Thanks a lot for your contribution!

@janeczku janeczku merged commit c1be9a7 into janeczku:master Apr 3, 2016
OzzieIsaacs pushed a commit that referenced this pull request Aug 12, 2017
deldesir referenced this pull request in iiab/calibre-web Sep 26, 2023
Revert "Update cover to retain correct aspect ratio"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants