NYPL-Simplified / circulation

Circulation manager for Library Simplified
Other
19 stars 19 forks source link

Correctly set active search facet #1905

Closed keithbauer closed 1 year ago

keithbauer commented 1 year ago

Description

Correctly set the active search facet

Motivation and Context

My previous hacky attempt didn't actually set the @opds:activeFacet in the OPDS feed. I thought the URL would pick up on it and do some background magic, but it didn't look like it did.

This now builds out a facet link by using cls.facet_link to ensure the activeFacet property is correctly set. But this generates a .../feed/... URL and we want a .../search... URL, so then we replace the href with what annotator.search_url builds before adding the facet to the OPDS feed.

How Has This Been Tested?

More manual testing and verifying the search OPDS feed for the active facet is set through +@opds:activeFacet: "true"

Checklist:

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01% :warning:

Comparison is base (5c1b5d2) 92.56% compared to head (58bb111) 92.56%. Report is 5 commits behind head on develop.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #1905 +/- ## =========================================== - Coverage 92.56% 92.56% -0.01% =========================================== Files 216 216 Lines 43659 43660 +1 =========================================== Hits 40412 40412 - Misses 3247 3248 +1 ``` | [Files Changed](https://app.codecov.io/gh/NYPL-Simplified/circulation/pull/1905?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NYPL-Simplified) | Coverage Δ | | |---|---|---| | [core/opds.py](https://app.codecov.io/gh/NYPL-Simplified/circulation/pull/1905?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NYPL-Simplified#diff-Y29yZS9vcGRzLnB5) | `94.93% <100.00%> (+<0.01%)` | :arrow_up: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/NYPL-Simplified/circulation/pull/1905/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NYPL-Simplified)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.