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

Book added to shelf but not shown in shelf #2677

Closed
pseudocoder opened this issue Jan 26, 2023 · 7 comments
Closed

Book added to shelf but not shown in shelf #2677

pseudocoder opened this issue Jan 26, 2023 · 7 comments

Comments

@pseudocoder
Copy link

Describe the bug/problem

For several specific books (out of thousands), adding to a shelf doesn't really work. The book itself shows the shelf tag, but in the shelf it is not shown, and also this is a Kobo sync shelf and the book is not synced.

Strangely, for another user it works fine.

I've tried giving the "problem" user full rights to everything and it didn't help; I also tried deleting and recreating the shelf or adding the book to another shelf, nothing works.

To Reproduce

  • Open problem book
  • Add to shelf, confirm shelf tag is shown on book
  • Look in shelf, book is not there

Logfile

There is nothing in the log even with debug on.

Expected behavior

Book is added to the shelf.

Environment (please complete the following information):

  • OS: Linux 5.10.0-20-amd64 Unable to create Admin user #1 SMP Debian 5.10.158-2 (2022-12-13) x86_64 x86_64
  • Python version: 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]
  • Calibre-Web version: 0.6.19 - b5d5660 - 2022-07-31T16:14:03+02:00
  • Docker container: LinuxServer
  • Special Hardware: none
  • Browser: Edge 109.0.1518.61

Additional context

The book is added to the book_shelf_link table, in fact all the records in the calibre-web db don't look any different to books where shelf adding works properly.

In the Calibre database the book records also looks fine, nothing obviously wrong.

I added the book to Calibre a second time, and this second instance works fine with shelves.

Is there some way to see the query being run to populate the shelf?

@OzzieIsaacs
Copy link
Collaborator

Duplicate of #2627. I can't reproduce this

@OzzieIsaacs
Copy link
Collaborator

Calibre-web is using SQLalchemy, so there are no raw sql querys visible, it's looking like function calls. If you say the books are in the shelfs book link table, than the view route is the one in question.
The relevant code is starting here: https://github.com/janeczku/calibre-web/blob/master/cps/shelf.py#L412
Because everything is the same, this is handled via a function call, building the query function based on parameters. If you debug it, the object contains the generated sqlquery somewhere in it (maybe only visible if you remove the call to the all() function

query = query.filter(db.Books)
.filter(self.common_filters(allow_show_archived)).outerjoin(ub.BookShelf, ub.BookShelf.book_id == db.Books.id]).order_by(ub.BookShelf.order.asc()).offset(off).limit(pagesize).all()

-> commonfilters: all the filters which are applied if you have only one language visible or only certain tags or values of a custom column
-> off: Offest for current page
-> pagesize: number of books on one page to show
If you have the read status linked to a custom calibre column, the query is a bit more complex, as it's also outputting the readstatus
After the query books which are no longer in the database are deleted from the result, but this would result in a log.info about this, so this doesn't seem to be valid for you.
So from my point of view the suspicous thing would be the read status linked to custom column. For the other issue, I could not replicate it even with the app.db database.

@Deanna4711
Copy link

For several specific books (out of thousands), adding to a shelf doesn't really work. The book itself shows the shelf tag, but in the shelf it is not shown, and also this is a Kobo sync shelf and the book is not synced.

Just a question: The books you can't see in shelves, are they marked as archived? Then they wont show up in the shelf.

@pseudocoder
Copy link
Author

Yes, that is exactly it!

But I have no idea why ca. 25% of the books for just one user would be marked as archived, is there some automated process that can do this?

And is there any way to unarchive them in bulk, or do I just have to edit the database?

@Deanna4711
Copy link

Deanna4711 commented Feb 6, 2023

And is there any way to unarchive them in bulk, or do I just have to edit the database?

Actually I have no clue. The archived marker doesn't show up in my database so I have to unmark them one by one.
My guessing was, they show up on read books. But not on every book I've read. So it's a miracle!

@pseudocoder
Copy link
Author

Thanks - I just deleted all the rows from the archived_books table and everything looks fine.

@Maximus48p
Copy link

I'm running Calibre and calibre-web in a docker environment. Having similar problem.
A lot of books are not added/attached to the shelf. When i click on the book it says it is attached to the shelf, but when i open the shelf, the book is not there.
Don't have access to the database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants