Skip to content

[PP-3602] Add target_age range based on Work.target_age rather than b…#3041

Merged
dbernstein merged 3 commits intomainfrom
feature/PP-3602-add-age-range-information-to-inventory-report
Feb 17, 2026
Merged

[PP-3602] Add target_age range based on Work.target_age rather than b…#3041
dbernstein merged 3 commits intomainfrom
feature/PP-3602-add-age-range-information-to-inventory-report

Conversation

@dbernstein
Copy link
Contributor

@dbernstein dbernstein commented Feb 11, 2026

…isac subjects.

Description

Replace inventory report age range with Work.target_age

  • Dropped age ranges from _bisac_subjects_subquery() so it only returns BISAC subject names.
    Added a target_age column in the inventory report using Work.target_age and the same formatting as numericrange_to_string (e.g. "12-14", "18-", "").
  • Renamed the report column from age_ranges to target_age.
  • Updated expectations and assertions to match the new target_age column.

Motivation and Context

The current solution does not resolve target age values in the same way that they are resolved in the opds2 feed that drives the target age values displayed by Admin UI's classifications tab. As a result we are not seeing some age ranges that were imported under schema:suggested_min_age and schema:suggested_max_age tags.
https://ebce-lyrasis.atlassian.net/browse/PP-3602

How Has This Been Tested?

Unit tests updated. Manually tested on minotaur.

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.04%. Comparing base (9b984be) to head (585701a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3041      +/-   ##
==========================================
- Coverage   93.04%   93.04%   -0.01%     
==========================================
  Files         480      480              
  Lines       43716    43720       +4     
  Branches     6027     6029       +2     
==========================================
+ Hits        40677    40679       +2     
- Misses       1968     1969       +1     
- Partials     1071     1072       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbernstein dbernstein force-pushed the feature/PP-3602-add-age-range-information-to-inventory-report branch from 4e4fe67 to 91551ab Compare February 12, 2026 00:02
@dbernstein dbernstein marked this pull request as ready for review February 12, 2026 16:36
@dbernstein dbernstein force-pushed the feature/PP-3602-add-age-range-information-to-inventory-report branch from 24473b8 to 002276f Compare February 13, 2026 17:15
@dbernstein dbernstein requested a review from a team February 13, 2026 18:19
Copy link
Contributor

@tdilauro tdilauro left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Approved now, but I've requested a comment about what is being formatted in the query.

target_age_upper_raw = func.upper(Work.target_age)
target_age_lower_adj: ColumnElement[Any] = case(
(func.lower_inc(Work.target_age), target_age_lower_raw),
else_=target_age_lower_raw + 1,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand the intention of the case logic here. Please explain in a comment here or above l. 422.

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand better from the tests now, but I still think it would be good to add an overall comment in this section.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm going to refactor this to use our existing numericrange_to_string function which implements the same logic with a slight modification (namely that ranges with open ended upper bounds are rended as {lower} rather than "{lower}-" to keep things consistent across the app.

)
target_age_upper_adj: ColumnElement[Any] = case(
(func.upper_inc(Work.target_age), target_age_upper_raw),
else_=target_age_upper_raw - 1,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand the intention of the case logic here. Please explain in a comment here or above l. 422.

@dbernstein dbernstein force-pushed the feature/PP-3602-add-age-range-information-to-inventory-report branch from 002276f to 585701a Compare February 17, 2026 17:34
@dbernstein dbernstein merged commit 22f97ed into main Feb 17, 2026
19 checks passed
@dbernstein dbernstein deleted the feature/PP-3602-add-age-range-information-to-inventory-report branch February 17, 2026 18:16
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.

2 participants

Comments