Skip to content

Conversation

@melton-jason
Copy link
Contributor

@melton-jason melton-jason commented Dec 18, 2024

Fixes #5474
Related to #5232

Allows the selection of Collection Object Type (COT) Catalog Number formats in the Query Builder!:

Screenshot 2024-12-17 at 11 34 05 PM

Known edge case: #5487 and #5488

Checklist

  • Self-review the PR after opening it to make sure the changes look good and
    self-explanatory (or properly documented)
  • Add automated tests
  • Add relevant issue to release milestone

Testing instructions

  • Create a CollectionObjectType with a Catalog Number Format Name which differs from that of the Collection's default Catalog Number format

    • You can run a query on the Collection table with the Catalog Num Format Name field to determine the default format
  • Create a new Collection Object query, add Catalog Number to the query, and switch the type from Any to any of:

    • Equal
    • Greater than
    • Less than
    • Greater or Equal to
    • Less or Equal to
    • Between
    • In
    • (all other types-like Contains or Starts With- have validation disabled by default)
  • Ensure that by default, the Collection's default Catalog Number format is enforced

  • Switch the Catalog Number format to the previously created Collection Object Type using the new gear icon and picklist

  • Ensure the input of the field is now validating based on the format defined on the chosen Collection Object Type

  • Add one or more OR filters to the Catalog Number field (this can be done through the + button) with a type from the list above

  • Ensure each filter on the Catalog Number field with validation can independently have its own format

  • Save the Query and refresh the page: the Query should load successfully

  • Ensure the query returns correct results when using filters with multiple Catalog Number formats

  • If there is only one CollectionObjectType or all CollectionObjectTypes either don't specify a Catalog Number format or use the Collection's default, then the gear icon to select a formatter should not appear on Catalog Number

  • Collection Object -> Catalog Number along with formatted/aggregated fields are the only filters which should have the gear icon to select a format

  • Briefly generally test other functionality of the Query Builder, such as: running old queries, selecting a different record formatter (Add support for explicitly choose a formatter in QB #4615), Query From Tree Node, etc.

@melton-jason melton-jason added this to the 7.9.10 milestone Dec 18, 2024
@melton-jason melton-jason requested review from a team December 18, 2024 06:33
Copy link
Contributor

@alesan99 alesan99 left a comment

Choose a reason for hiding this comment

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

Testing instructions

  • Ensure that by default, the Collection's default Catalog Number format is enforced
  • [c] Ensure the input of the field is now validating based on the format defined on the chosen Collection Object Type
  • Ensure each filter on the Catalog Number field with validation can independently have its own format
  • [c] Save the Query and refresh the page: the Query should load successfully
  • Ensure the query returns correct results when using filters with multiple Catalog Number formats
  • If there is only one CollectionObjectType or all CollectionObjectTypes either don't specify a Catalog Number format or use the
  • Briefly generally test other functionality of the Query Builder, such as: running old queries, selecting a different record formatter (#4615), Query From Tree Node, etc.

The functionality looks good! 👍👍
I just have a minor note

If multiple COTs share the same formatter the selection dropdown always chooses the first one with that format. It's a little weird but the functionality works since it is the same formatter after all.
I imagine in practice most people will have a different formatter for each COT if they aren't sticking with the default, but if someone comes across this it may appear broken.

chrome_zfCxfAL2N3.mp4

The queries also not filtered very strictly and YEAR-###### includes ######## results, which is more noticeable when doing 'less than' queries.
Though this is in line with normal Catalog Number behavior and its easily solvable by adding COT to your query.

@alesan99 alesan99 requested a review from a team December 18, 2024 19:02
Copy link
Contributor

@alesan99 alesan99 left a comment

Choose a reason for hiding this comment

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

I've made a separate report for the issue I encountered -> #5503

Looks good to go 👍👍👍

@CarolineDenis CarolineDenis merged commit f009a39 into production Dec 20, 2024
12 checks passed
@CarolineDenis CarolineDenis deleted the issue-5232-qb branch December 20, 2024 16:25
melton-jason added a commit that referenced this pull request May 1, 2025
…eric

Fixes #6464
See related #5485 and #6245

This handles the most common case.
In the case where there exists both numeric and non-numeric formats for
catalogNumber, the numeric formats will still be cast as a string.
This also ONLY works with formats called CatalogNumberNumeric;
i.e., any other purely numeric format will not be considered as numeric
by the QueryBuilder
sharadsw added a commit that referenced this pull request May 2, 2025
…0.2` (#6465)

* Handle case where rank name has spaces

* Use name as default tree rank query

* Handle edge case for fullname query

* Use name for fullname

* Skip test temporarily

* Revert mapping for fullname

* Fix case for fullName query with 1 space in rank
- Also adds a unit test to ensure this doesn't break again

* Cast catalogNumber to Numeric in query results if all formats are numeric

Fixes #6464
See related #5485 and #6245

This handles the most common case.
In the case where there exists both numeric and non-numeric formats for
catalogNumber, the numeric formats will still be cast as a string.
This also ONLY works with formats called CatalogNumberNumeric;
i.e., any other purely numeric format will not be considered as numeric
by the QueryBuilder

* Add comment to catalogNumber cast for queries

---------

Co-authored-by: melton-jason <meltonjason12@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Support COT-based Catalog Numbering Configurations in the Query Builder

6 participants