Skip missing books in IA carousels#12804
Conversation
|
Thanks for the pull request! 🤖 Copilot has been assigned for an initial review. A reviewer must first be assigned. There are currently 17 open PRs of equal or higher priority ahead of yours. PR triage checklist (maintainers / Pam)
Note This comment was automatically generated by Pam, Open Library's Project AI Manager, on behalf of @mekarpeles. Pam is designed to provide status visibility, perform basic project management functions and relevant codebase research, and provide actionable feedback so contributors aren't left waiting. |
There was a problem hiding this comment.
Pull request overview
Fixes IA carousel rendering on the home page by filtering out missing/falsey entries returned from lending.get_available() so a single bad item doesn’t break formatting.
Changes:
- Filter IA carousel results to skip
None/falsey entries (in addition to'error') before callingformat_book_data(). - Add a regression test ensuring missing books are skipped and valid books are still formatted.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
openlibrary/plugins/openlibrary/home.py |
Filters IA carousel book list to exclude falsey entries before formatting. |
openlibrary/plugins/openlibrary/tests/test_home.py |
Adds a unit test covering the “skip missing books” behavior. |
Closes #12740
fix
Skips missing entries returned from Archive carousel data so one bad/missing item does not break the IA carousel rendering.
Technical
get_ia_carousel_books()already skipped"error"entries fromlending.get_available(), but did not skip missing/falsey entries likeNone.This PR updates the filtering so only real book objects are passed to
format_book_data().Testing
docker compose run --rm home pytest openlibrary/plugins/openlibrary/tests/test_home.py -q
docker compose run --rm home ruff check openlibrary/plugins/openlibrary/home.py openlibrary/plugins/openlibrary/tests/test_home.py
Screenshot
N/A. This is a backend carousel data handling fix.
Stakeholders
@RayBB @mekarpeles @seabelis