Skip to content

Conversation

@grantfitzsimmons
Copy link
Member

@grantfitzsimmons grantfitzsimmons commented Oct 2, 2025

Fixes #7468
Possibly fixes #1710

There is an issue where catalog numbers shown in other collections via the Collection Relationship mechanism are still cast to integers, resulting in the catalog number displaying as 0 instead of the original value. These non-numeric catalog numbers should not be cast to ensure the correct value is shown. If it is an number, it should still be cast to preserve existing behavior.

In this PR, catalog numbers are now conditionally cast to Numeric(65) only if they match a numeric pattern (using a regex check for integers or decimals). Non-numeric strings like 'F-235694' are left as strings.

  • There is now a case statement with a regex check before casting the catalog number if it is a numeric catalog number format.
  • The regex ^-?[0-9]+(\.[0-9]+)?$ matches optional negative sign, digits, and optional decimal part.
  • If the catalog number is numeric (e.g., '123' or '123.45'), it's cast to Numeric(65) like before.
  • If it's a string (e.g., 'F-235694'), it's left as a string.

Screenshots

Current behavior:
Image

Desired behavior:
Image

Checklist

  • Self-review the PR after opening it to make sure the changes look good and
    self-explanatory (or properly documented)
  • Add relevant issue to release milestone
  • Add pr to documentation list
  • Add automated tests
  • Add a reverse migration if a migration is present in the PR

Testing instructions

  1. Use a database where there is a collection relationship from one collection with a CatalogNumberNumeric format to one with a string
  2. Build a query that includes both the catalog number for the object in the main collection and the catalog number from the related collection (via the Collection Relationship mechanism)
  3. See that the string catalog numbers are incorrectly cast (shown as 000000000)

In my example, the related catalog number is F-235694, but when cast, this becomes 0. This is shown in the query results as 000000000.

Image

Cat # Issue.json

  • Verify that this casting issue is no longer occuring
  • Test reports and labels to verify there are no crashes when displaying the catalog number

@github-project-automation github-project-automation bot moved this to 📋Back Log in General Tester Board Oct 2, 2025
@grantfitzsimmons grantfitzsimmons added this to the 7.12.0 milestone Oct 2, 2025
@grantfitzsimmons grantfitzsimmons marked this pull request as ready for review October 2, 2025 12:07
Copy link
Collaborator

@emenslin emenslin left a comment

Choose a reason for hiding this comment

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

  • Verify that this casting issue is no longer occuring
  • Test reports and labels to verify there are no crashes when displaying the catalog number

Looks good!
image

@emenslin emenslin requested a review from a team October 8, 2025 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📋Back Log

4 participants