X Tutup
Skip to content

Add ebook filter to mybooks + use standard sort dropper#11868

Merged
mekarpeles merged 2 commits intointernetarchive:masterfrom
cdrini:feature/wtr-ebook-filter
Feb 23, 2026
Merged

Add ebook filter to mybooks + use standard sort dropper#11868
mekarpeles merged 2 commits intointernetarchive:masterfrom
cdrini:feature/wtr-ebook-filter

Conversation

@cdrini
Copy link
Collaborator

@cdrini cdrini commented Feb 14, 2026

Uses the UI from the authors page; although we should change this to be a toggle button!

Technical

Testing

Screenshot

Before:
image

After:
image

Stakeholders

@mekarpeles @davidscotson

@cdrini cdrini marked this pull request as ready for review February 20, 2026 17:59
Copilot AI review requested due to automatic review settings February 20, 2026 17:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds an ebook filter to the reading log pages (want-to-read, currently-reading, already-read) and standardizes the sort options UI by using the same dropdown component from the authors page. Users can now filter their reading log to show only ebooks using a mode parameter, with toggle links to switch between showing everything and only ebooks.

Changes:

  • Added ebook filtering functionality using Solr filter queries with ebook_access field
  • Replaced custom sort UI with standard sort_options.html template component
  • Added CSS styling for filter controls and adjusted header padding

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
openlibrary/plugins/upstream/mybooks.py Added mode parameter handling and fq (filter query) construction for ebook filtering in both web and JSON endpoints
openlibrary/core/bookshelves.py Added fq parameter to reading log query functions to support additional Solr filter queries
openlibrary/templates/account/reading_log.html Replaced custom sort UI with standard template, added ebook filter toggle, and updated conditional display logic
openlibrary/templates/search/sort_options.html Added reading_log search scheme with Date Added sort options
static/css/components/mybooks-list.less Added margin spacing for chip-group and search-results-stats elements
static/css/components/mybooks-details.less Removed header padding to align with standard sort dropper UI
openlibrary/i18n/messages.pot Moved translation strings for sort options from reading_log.html to sort_options.html for reuse
Comments suppressed due to low confidence (3)

openlibrary/core/bookshelves.py:406

  • The docstring should be updated to document the new fq parameter, which is used to apply additional Solr filter queries (e.g., for ebook filtering). Consider adding something like ":param fq: optional list of Solr filter queries to apply to the results."
        """
        Returns LoggedBooksData containing Reading Log database records for books that
        the user has logged. Also allows filtering/searching the reading log shelves,
        and sorting reading log shelves (when not filtering).

        The returned records ultimately come from Solr so that, as much as possible,
        these query results may be used by anything relying on logged book data.

        :param username: who logged this book
        :param bookshelf_id: the ID of the bookshelf, see: PRESET_BOOKSHELVES.
            If bookshelf_id is None, return books from all bookshelves.
        :param q: an optional query string to filter the results.
        """

openlibrary/core/bookshelves.py:472

  • The docstring should be updated to document the new fq parameter, which is used to apply additional Solr filter queries. Consider adding documentation for this parameter to explain its purpose and expected format.
            """
            Filter reading log books based an a query and return LoggedBooksData.
            This does not work with sorting.

            The reading log DB alone has access to who logged which book to their
            reading log, so we need to get work IDs and logged info from there, query
            Solr for more complete book information, and then put the logged info into
            the Solr response.
            """

openlibrary/plugins/upstream/mybooks.py:573

  • The docstring should be updated to document the new fq parameter. Consider adding documentation for all parameters including the new fq parameter to explain their purposes.
        """
        Get works for want-to-read, currently-reading, and already-read as
        determined by {key}.

        See LoggedBooksData for specifics on what's returned.
        """

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mekarpeles mekarpeles self-assigned this Feb 23, 2026
@mekarpeles mekarpeles merged commit feeb72e into internetarchive:master Feb 23, 2026
4 of 5 checks passed
lokesh added a commit to lokesh/openlibrary that referenced this pull request Feb 23, 2026
…s (ported to CSS)

Ported mybooks-details.less change (removed header padding) and
mybooks-list.less changes (chip-group margin, search-results-stats margin)
to their CSS equivalents. Deleted incoming .less file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
lokesh added a commit to lokesh/openlibrary that referenced this pull request Feb 23, 2026
…s (ported to CSS)

Ported mybooks-details.less change (removed header padding) and
mybooks-list.less changes (chip-group margin, search-results-stats margin)
to their CSS equivalents. Deleted incoming .less file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

3 participants

X Tutup