Skip to content

Display availability statements when relevant#408

Open
matt-bernhardt wants to merge 5 commits into
mainfrom
use-599
Open

Display availability statements when relevant#408
matt-bernhardt wants to merge 5 commits into
mainfrom
use-599

Conversation

@matt-bernhardt

@matt-bernhardt matt-bernhardt commented Jun 15, 2026

Copy link
Copy Markdown
Member

This integrates the recently-added AlmaSru model with the UI, restoring the availability statements for users to see. This involves:

  1. Defining a lookup route /almasru which invokes the lookup method
  2. Adding a _trigger pattern on the Primo result partial that will invoke this lookup route when needed

In service of these goals, a few other changes get introduced:

  1. The content loader stimulus controller gets added support for lazy loading, which gets activated by adding data-content-loader-lazy-loading-value="" to the tag which calls the controller.
  2. The AlmaSru model gets its validation and extraction logic altered, so that there is an externally-callable valid_alma_id?() method. The UI leverages this to make sure we only ask for this lookup when the ID seems relevant (there's no way to know from just an identifier whether a record will actually have an availability block - but we can tell when a record comes from Alma).

Side effects:

  • The guard clauses around this integration are a little inconsistent at the moment. I don't think any of the calculations are horribly inefficient, so I think it's probably fine - but I'd welcome some specific attention on this point.
  • The "enabled?" method on AlmaSru gets renamed from .alma_sru_enabled? to just .enabled?
  • I alphabetized the lookup routes in config/routes.rb

Developer

Accessibility
  • ANDI or WAVE has been run in accordance to our guide.
  • This PR contains no changes to the view layer.
  • New issues flagged by ANDI or WAVE have been resolved.
  • New issues flagged by ANDI or WAVE have been ticketed (link in the Pull Request details above).
  • No new accessibility issues have been flagged.
New ENV
  • All new ENV is documented in README.
  • All new ENV has been added to Heroku Pipeline, Staging and Prod.
  • ENV has not changed.
Approval beyond code review
  • UXWS/stakeholder approval has been confirmed.
  • UXWS/stakeholder review will be completed retroactively.
  • UXWS/stakeholder review is not needed.
Additional context needed to review

Do searches in the review app (or when running locally), and watch the network traffic in your dev tools. You should see lazy-loading happening, and you should only see this happening for records with Alma docIDs. This should happen across tabs.

Code Reviewer

Code
  • I have confirmed that the code works as intended.
  • Any CodeClimate issues have been fixed or confirmed as
    added technical debt.
Documentation
  • The commit message is clear and follows our guidelines
    (not just this pull request message).
  • The documentation has been updated or is unnecessary.
  • New dependencies are appropriate or there were no changes.
Testing
  • There are appropriate tests covering any new functionality.
  • No additional test coverage is required.

@coveralls

coveralls commented Jun 15, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 27716939663

Coverage increased (+0.01%) to 98.415%

Details

  • Coverage increased (+0.01%) from the base build.
  • Patch coverage: 20 of 20 lines across 2 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1514
Covered Lines: 1490
Line Coverage: 98.41%
Coverage Strength: 71.52 hits per line

💛 - Coveralls

@mitlib mitlib temporarily deployed to timdex-ui-pi-use-599-ivehx6dtf June 15, 2026 20:57 Inactive
@mitlib mitlib temporarily deployed to timdex-ui-pi-use-599-ivehx6dtf June 15, 2026 23:01 Inactive
@mitlib mitlib temporarily deployed to timdex-ui-pi-use-599-ivehx6dtf June 16, 2026 19:05 Inactive
@mitlib mitlib temporarily deployed to timdex-ui-pi-use-599-ivehx6dtf June 16, 2026 20:53 Inactive
@qltysh

qltysh Bot commented Jun 16, 2026

Copy link
Copy Markdown

❌ 2 blocking issues (3 total)

Tool Category Rule Count
rubocop Lint Method has too many lines. [16/10] 1
rubocop Style Use underscores(_) as thousands separator and separate every 3 digits with them. 1
qlty Structure Function with high complexity (count = 5): lookup 1

@mitlib mitlib temporarily deployed to timdex-ui-pi-use-599-ivehx6dtf June 17, 2026 19:50 Inactive
Comment thread app/models/alma_sru.rb Outdated
Comment thread app/models/alma_sru.rb Outdated
# valid_alma_id? method
test 'valid_alma_id? returns true for valid inputs' do
needles = [
990002935920106761,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Use underscores(_) as thousands separator and separate every 3 digits with them. [rubocop:Style/NumericLiterals]

This will be loaded via Stimulus when needed in a subsequent commit.

Alma SRU controller tests
@mitlib mitlib temporarily deployed to timdex-ui-pi-use-599-ivehx6dtf June 17, 2026 20:04 Inactive
This still needs to be filtered, most likely (tho the AlmaSru model
will also do its own filtering)

Squash
This involves adding lazy-loading support to the content loader
controller, which may be a feature that other async calls would
benefit from.
This allows for better DX throughout the UI.
- Also adds additional filter on UI invoking this path, leveraging new validation method
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