Conversation
Coverage Report for CI Build 31750706282Coverage increased (+0.003%) to 98.327%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
❌ 5 blocking issues (5 total)
|
Why these changes are being introduced: Certain catalog records include an electronic holding that is not included in the `links` `object of the PNX metadata. For these records, Primo displays a 'Full-text options' section with the e-resource link, but SML displays nothing because it only checks `links` for this information. Relevant ticket(s): - [USE-663](https://mitlibraries.atlassian.net/browse/USE-663) How this addresses that need: This adds 'Full-text options' to a result's `links` object, provided the result meets the following conditions: - pnx['links'] is nil - pnx['deliveryCategory'] includes Alma-E The 'Full-text options' link resolves to the corresponding section of the Primo record. Side effects of this change: This decision infers that all Primo records that meet the two conditions above will have a 'Full-text options' section. If this assumption is incorrect, it will result in a confusing user experience.
There was a problem hiding this comment.
Pull request overview
Adds support for showing a “Full-text options” link for certain Alma Primo records that have electronic availability (Alma‑E) but don’t include the expected pnx.links metadata, aligning the UI behavior more closely with what Primo shows in its own full display.
Changes:
- Extend
NormalizePrimoRecord#linksto append a “Full-text options” link (anchored to the Primo “View It” section) whenpnx.linksis nil anddeliveryCategoryincludesAlma-E. - Add model tests covering inclusion/exclusion rules for the new link behavior.
- Make
frbrized?consistently return a boolean (falseinstead ofnil) when FRBR facet data is missing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| app/models/normalize_primo_record.rb | Adds conditional “Full-text options” link generation and tightens frbrized? boolean behavior. |
| test/models/normalize_primo_record_test.rb | Adds coverage for when the “Full-text options” link should and shouldn’t be included. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| def frbrized? | ||
| return unless @record['pnx']['facets'] | ||
| return unless @record['pnx']['facets']['frbrtype'] | ||
| return false unless @record['pnx']['facets'] |
There was a problem hiding this comment.
These changes are a result of running rubocop. They are unrelated to this feature.
| end | ||
|
|
||
| # Return links if we found any | ||
| links.any? ? links : [] |
There was a problem hiding this comment.
Found 4 issues:
1. Assignment Branch Condition size for links is too high. [<4, 44, 15> 46.66/17] [rubocop:Metrics/AbcSize]
2. Cyclomatic complexity for links is too high. [16/7] [rubocop:Metrics/CyclomaticComplexity]
3. Method has too many lines. [27/10] [rubocop:Metrics/MethodLength]
4. Perceived complexity for links is too high. [17/8] [rubocop:Metrics/PerceivedComplexity]
|
This has provisionally passed QA. The wording of the link might change pending feedback from UXWS, but nothing else should change that would affect code review. |
Why these changes are being introduced:
Certain catalog records include an electronic
holding that is not included in the
linksobject of the PNX metadata. For these records, Primo displays a 'Full-text options' section with the e-resource link, but SML displays nothing because it only checkslinks` for thisinformation.
Relevant ticket(s):
How this addresses that need:
This adds 'Full-text options' to a result's
linksobject, provided the result meets thefollowing conditions:
The 'Full-text options' link resolves to the
corresponding section of the Primo record.
Side effects of this change:
This decision infers that all Primo records that
meet the two conditions above will have a
'Full-text options' section. If this assumption
is incorrect, it will result in a confusing user
experience.
Developer
Accessibility
New ENV
Approval beyond code review
Additional context needed to review
Searching for "Sea otters: a history" in the PR build will return as the top result a record that should include the 'Full-text options' link.
Code Reviewer
Code
added technical debt.
Documentation
(not just this pull request message).
Testing