feat: add 'Stopped Reading' bookshelf and related functionality - #12400
Conversation
|
Thanks for the PR, @Sadashii! Copilot has been assigned for an initial review. @mekarpeles is assigned to this PR and currently has:
Possible improvements for this PR
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
Adds a new preset Reading Log shelf (“Stopped Reading”, intended ID: 4) and wires it through the database defaults, backend reading-log/trending logic, Solr schema/index types, and multiple UI surfaces so users can mark and view books they’ve stopped reading.
Changes:
- Introduces preset shelf ID 4 (“Stopped Reading”) across DB seed data, backend constants, and reading-log UI templates/actions.
- Extends trending + reading-log querying/indexing/sorting to recognize stopped-reading counts and (for the HTML trending page) filter stopped-reading out of trending activity.
- Updates Solr schema/types and worksearch sort options to support
stopped_reading_countand sorting by it.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/dev-instance/dev_db.pg_dump | Seeds the dev DB with bookshelf ID 4 row. |
| openlibrary/views/loanstats.py | Updates trending functions/caching signatures and filters HTML trending page to shelves 1–3. |
| openlibrary/templates/type/user/view.html | Adds “stopped-reading” link to public Reading Log blurb. |
| openlibrary/templates/trending.html | Adds shelf label for ID 4 in activity rendering and adjusts displayed timestamp field. |
| openlibrary/templates/search/sort_options.html | Adds “Stopped Reading” as a Reading Log sub-sort option. |
| openlibrary/templates/my_books/primary_action.html | Updates primary CTA label for read_status == 4. |
| openlibrary/templates/my_books/dropdown_content.html | Adds “Stopped Reading” option to the reading-log dropper UI. |
| openlibrary/templates/my_books/check_ins/check_in_prompt.html | Documents shelf ID 4 in template comments. |
| openlibrary/templates/books/mybooks_breadcrumb_select.html | Adds “Stopped Reading” to breadcrumb shelf selector. |
| openlibrary/templates/account/topmenu.html | Treats stopped-reading as a readinglog view for top menu rendering. |
| openlibrary/templates/account/sidebar.html | Adds “Stopped Reading” link + count to My Books sidebar. |
| openlibrary/templates/account/readinglog_shelf_name.html | Adds display name mapping for stopped-reading. |
| openlibrary/templates/account/reading_log.html | Adds stopped-reading handling for OG/meta and shelf mapping. |
| openlibrary/templates/account/privacy.html | Updates privacy copy to include stopped-reading. |
| openlibrary/templates/account/mybooks.html | Adds stopped-reading carousel to My Books page. |
| openlibrary/solr/updater/author.py | Adds stopped-reading facet aggregation into author solr updates. |
| openlibrary/solr/solr_types.py | Adds stopped_reading_count to SolrDocument typing. |
| openlibrary/solr/data_provider.py | Extends reading-log Solr summary typing with stopped-reading count. |
| openlibrary/plugins/worksearch/schemes/works.py | Adds field + sort mapping for stopped_reading_count. |
| openlibrary/plugins/upstream/mybooks.py | Extends reading-log routes/keys and My Books template context with stopped-reading. |
| openlibrary/plugins/upstream/account.py | Updates Reading Log CSV export bookshelf name mapping to include ID 4. |
| openlibrary/plugins/openlibrary/js/my-books/MyBooksDropper/ReadingLogForms.js | Adds STOPPED_READING shelf constant for client-side forms. |
| openlibrary/macros/StarRatingsStats.html | Shows “Stopped reading” count in work stats component. |
| openlibrary/fastapi/public_my_books.py | Extends FastAPI reading-log key Literal to include stopped-reading. |
| openlibrary/core/schema.sql | Seeds new bookshelf row for fresh DBs. |
| openlibrary/core/models.py | Adds stopped-reading to work “num users by bookshelf” mapping. |
| openlibrary/core/bookshelves.py | Adds shelf ID 4 to preset mappings and updates query helpers to accept lists of shelf IDs. |
| conf/solr/conf/managed-schema.xml | Adds stopped_reading_count field to Solr schema. |
|
@copilot apply changes based on the comments in this thread |
|
The different reading log pages are currently broken with this PR; see testing: |
612759f to
d97a584
Compare
for more information, see https://pre-commit.ci
…ple shelf IDs and update recent books retrieval
for more information, see https://pre-commit.ci
3aa0153 to
78ac0fa
Compare
|
On https://testing.openlibrary.org/people/mekBot/books/stopped-reading There may be spots where the Reading Log Dropper have not been updated. Or possibly Partials.
|
39dd2b7 to
df5d975
Compare
df5d975 to
ea56220
Compare
for more information, see https://pre-commit.ci
…p in trending section
|
Just fixed a merge conflict for you caused by #12778 |
for more information, see https://pre-commit.ci

Closes #2016
Description
Introduces a new "Stopped Reading" bookshelf (ID: 4). It works similar to the existing "Want to Read", "Currently Reading", and "Already Read" shelves, allowing patrons to track books they have paused reading. The implementation spans the database, Solr indexing, the Python backend, and the frontend templates to ensure the new shelf integrates seamlessly into the patron experience.
Technical
Database & Backend (openlibrary/core, openlibrary/plugins, etc.)
Search & Solr (openlibrary/solr, conf/solr)
Frontend & UI Updates (openlibrary/templates)
mybooks.html: Added a carousel for the new shelf to the main view.
sidebar.html: Added the shelf to the left sidebar.
mybooks_breadcrumb_select.html: Added the shelf to the page selector next to the account name.
topmenu.html: Added the shelf to the internal filter. This ensures the ‘My Reading Stats’, ‘Import/Export’, and ‘Privacy Settings’ buttons remain visible on the bookshelf and mybooks pages.
Note: The /trending Page Feed
Currently, the /trending page fetches recently logged books from all bookshelves. With the addition of this new shelf, the live feed would begin showing updates like: "Someone stopped reading [Book] x minutes ago", which feels counterintuitive for a "Trending" feed. It would also artificially inflate the "Logged x times" metrics for daily/weekly trends.
Solution implemented: Updated get_recently_logged_books and cached_get_most_logged_books to allow the bookshelf_id parameter to be passed as a list (shelf_ids). In loanstats.py, the database queries for the trending page now explicitly filter only for IDs 1, 2, and 3 (Want to Read, Currently Reading, Already Read), effectively filtering out the "Stopped Reading" shelf from the trending logic.
Database Migration
To upgrade an existing database, you must connect to PostgreSQL and manually run the following SQL insert statement to populate the default bookshelf:
(Note: The schema.sql and dev_db.pg_dump files have been updated for fresh setups).
Testing
Screenshots
StarRatingStats [UI Update 1] -


Old:
New: Will also show the x Stopped Reading count
My Books Page [UI Update 2]

Privacy Page [UI Update 3]

Primary Action Button [UI Update 4]

Book Location Dropper [UI Update 5]

User Profile Page for public users [UI Update 6]


Owner's view:
Visitor's view:
Display name of shelf on stopped reading stats page [UI Update 7]

Stakeholders
@mekarpeles