Skip to content

Commit

Permalink
Merge pull request #1903 from NYPL-Simplified/OE-927
Browse files Browse the repository at this point in the history
OE-917 [fix] Set the original facet to active
  • Loading branch information
keithbauer authored Aug 14, 2023
2 parents 153abf5 + 5c1b5d2 commit a702a88
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/opds.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,8 @@ def make_link(ep):
# the facet url for this given ordering facet instead of the original facet.
facets.order = order
facet["href"] = annotator.search_url(lane, query, pagination=None, facets=facets)
if order == original_facet:
facet["href"] += "&active=true"
AcquisitionFeed.add_link_to_feed(feed=opds_feed.feed, **facet)
facets.order = original_facet

Expand Down
3 changes: 3 additions & 0 deletions core/tests/test_opds.py
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,9 @@ def make_page(pagination):
assert 'Title' in sort_by_facets
assert 'Author' in sort_by_facets

[active_facet] = [facet['title'] for facet in facets if getattr(facet, "activefacet", False) == 'true']
assert active_facet == 'Author'

# The feed has no breadcrumb links, since we're not
# searching the lane -- just using some aspects of the lane
# to guide the search.
Expand Down

0 comments on commit a702a88

Please sign in to comment.