Skip to content

Sort the list carousel by last_modified#11607

Merged
mekarpeles merged 2 commits intomasterfrom
feature/sort-list-carousel
Dec 22, 2025
Merged

Sort the list carousel by last_modified#11607
mekarpeles merged 2 commits intomasterfrom
feature/sort-list-carousel

Conversation

@cdrini
Copy link
Copy Markdown
Collaborator

@cdrini cdrini commented Dec 19, 2025

Addendum to #11187 . Maintains previous, pre-solr behaviour.

Technical

Testing

Screenshot

Stakeholders

@cdrini cdrini marked this pull request as ready for review December 20, 2025 05:14
Copilot AI review requested due to automatic review settings December 20, 2025 05:14
Copy link
Copy Markdown
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 sorting by last_modified to list carousels, maintaining the pre-Solr behavior for list ordering. The changes ensure that when lists are displayed in carousels or accessed via search URLs, they are sorted by their most recent modification date in descending order.

  • Adds last_modified desc sorting to the Solr query in get_lists() function
  • Appends &sort=last_modified parameter to the list search URL for consistency

Reviewed changes

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

File Description
openlibrary/plugins/openlibrary/lists.py Adds sort='last_modified desc' parameter to the run_solr_query call in the get_lists() function
openlibrary/plugins/openlibrary/partials.py Appends &sort=last_modified to the URL query string for the "View All Lists" link

After thoroughly reviewing the code changes, I found no issues to report. The implementation is consistent and correct:

  • Both changes correctly implement sorting by last_modified in descending order
  • The URL parameter sort=last_modified in partials.py is automatically normalized to last_modified desc by the ListSearchScheme (as defined in line 42 of schemes/lists.py)
  • The direct parameter sort='last_modified desc' in lists.py is the proper format for the run_solr_query function
  • Both approaches achieve the same result: sorting lists by most recently modified first

The changes successfully restore the pre-Solr behavior as intended.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mekarpeles mekarpeles self-assigned this Dec 22, 2025
@mekarpeles mekarpeles merged commit 5d13753 into master Dec 22, 2025
14 checks passed
@mekarpeles mekarpeles deleted the feature/sort-list-carousel branch December 22, 2025 20:10
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