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

Possibility to rate from book page without editing #3085

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

ofostier
Copy link

Not sure for the right CSS file to edit

@AnonTester
Copy link
Contributor

thank you for working on this. I've applied the PR to my installation, but I don't see any rating option on the book detail page.
I'm using Calibreweb in docker from linuxserver.io version 0.6.22 Beta - 0925f34 - 2024-04-07T18:51:00+02:00 .
I tried the latest stable but the patch failed, and with the latest nightly 0.6.22 Beta - 89ac9ff - 2024-06-22T13:35:53+02:00 the detail page only contained three dots, so something is broken there.

@ofostier
Copy link
Author

ofostier commented Jul 1, 2024

Thanks for your feedback
I will try on docker setup

@ofostier
Copy link
Author

@AnonTester
I finaly work on with a docker-calibre-web pointing to my dedicated release.
I have just found a bug concerning the old-rating as None value (fixed)

Except that, everything working fine on my side

@AnonTester
Copy link
Contributor

Thanks, this looks better now, however, I get the following error when trying to change the rating of a book (tested both with a book that doesn't have any rating yet and with one that has an existing rating):

500 Internal Server Error
The server encountered an internal error and was unable to complete your request. There is an error in the application.

Traceback (most recent call last):
File "/lsiopy/lib/python3.10/site-packages/flask/app.py", line 2190, in wsgi_app
response = self.full_dispatch_request()
File "/lsiopy/lib/python3.10/site-packages/flask/app.py", line 1486, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/lsiopy/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
File "/lsiopy/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/lsiopy/lib/python3.10/site-packages/flask_login/utils.py", line 290, in decorated_view
return current_app.ensure_sync(func)(*args, **kwargs)
File "/app/calibre-web/cps/web.py", line 175, in toggle_rating
message = edit_book_rating(book_id,rating)
File "/app/calibre-web/cps/helper.py", line 310, in edit_book_rating
if not book.rating[0]:
AttributeError: 'Books' object has no attribute 'rating'. Did you mean: 'ratings'?

That's with the patch applied to the docker of 0.6.23 Beta - 02d2c2b - 2024-07-11T20:30:35+02:00

I had to adjust the patch to not overwrite my metadata.db though.

@ofostier
Copy link
Author

Hmmm this is what I fixed
Are you using this release ?

@AnonTester
Copy link
Contributor

I'm using the linuxserver/calibre-web:nightly docker image and applied the patch from this PR (https://github.com/janeczku/calibre-web/pull/3085.patch) to it after removing the metadata part from the patch. The docker image is based on the latest commit from 5 days ago.

workflow:

wget https://github.com/janeczku/calibre-web/pull/3085.patch
docker cp 3085.patch calibre-web:/app/calibre-web
docker exec -ti calibre-web /bin/bash
# in the docker container's shell
apt update
apt install patch
cd /app/calibre-web
patch -p1 < 3085.patch
exit
# restarting the container
docker container restart calibre-web

my docker compose file just for reference:

name: calibre-web
services:
  calibre-web:
    image: linuxserver/calibre-web:nightly #latest or nightly
    container_name: calibre-web
    restart: unless-stopped
    environment:
      - TZ=Europe/London
      - PUID=1010 # ID of user to take ownership of application/files
      - PGID=1010 # GID of user to take ownership of application/files
    volumes:
      - /opt/calibreweb-storage/config:/config # Where calibre-web stores the internal database and config.
      - /opt/calibreweb-storage/cache:/app/calibre-web/cps/cache # Where calibre-web stores the cache.
      - /opt/calibreweb-storage/ebooks:/books # Where your calibre database is located
    ports:
      - 8083:8083/tcp # Webui

@ofostier
Copy link
Author

Strange cause the fix concening the error 500 is include in this patch
Can you retry

@AnonTester
Copy link
Contributor

same code in your release file and the patch here. I did some light testing and changing line 310 in helper.py to "if not book.ratings:" helps some, but I got some other errors and now got a book where the rating cannot be unset and getting error "Oops! Database Error: UNIQUE constraint failed: books_ratings_link.book, books_ratings_link.rating."

I'll do some more testing tonight and get back to you with my results.

@ofostier
Copy link
Author

ofostier commented Jul 16, 2024

Thanks, I also found this error and fixed it.
We cannot unrating witout editing ebook (can try to add this feature soon)

Now I cannot get the Error 500 anymore but I cannot reproduce your new error concerning the Db constraint

Fix rating
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