Skip to content

Add parent cat num to empty child cat num if pref true in QB #6419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: issue-6409
Choose a base branch
from

Conversation

CarolineDenis
Copy link
Contributor

@CarolineDenis CarolineDenis commented Apr 15, 2025

Fixes #6410

Warning

This PR affects database migrations. See migration testing instructions.

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 relevant documentation (Tester - Dev)
  • Add automated tests
  • Add a reverse migration if a migration is present in the PR

Testing instructions

A) Change the inheritance pref in collection app resource

In your "collection preference" app resource add this snippet of code:
"catalogNumberParentInheritance": {
"behavior": {
"inheritance": true
}
}

C) Test the inheritance in QB with pref true

  • Create a new CO with a cat num (parent)
  • Save
  • Add a child CO with a catalog number (child 1)
  • Save
  • Add a second child CO without catalog numbers (child 2) with a different COType than the parent.
  • Save
  • Create a CO query builder query.
  • Add a catalog number field, and set the filter to 'Equal', and set the value to the catalog number of the parent CO.
  • Run the query
  • Verify that two CO records are returned with the parent cat num for the cat num column value
  • Confirm that one is the parent CO, and the other is the child.
  • Export to CSV
  • Verify that the primary cat num fill the column for the empty ones
  • Add another field with a filter on it (like COType).
  • Verify that the additional filter is applied

@CarolineDenis CarolineDenis linked an issue Apr 16, 2025 that may be closed by this pull request
@CarolineDenis CarolineDenis changed the title Add parent cat num to empty child cat num if pref true Add parent cat num to empty child cat num if pref true in QB Apr 16, 2025
@CarolineDenis CarolineDenis marked this pull request as ready for review April 16, 2025 16:47
@CarolineDenis
Copy link
Contributor Author

! todo:
adapt pr with inheritance for COG primary CO

Copy link
Contributor

@sharadsw sharadsw left a comment

Choose a reason for hiding this comment

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

Inheritance doesn't seem to work in this PR. Looks like this PR needs to be based on #6412 instead of #6408?

@github-project-automation github-project-automation bot moved this from 📋Back Log to Dev Attention Needed in General Tester Board Apr 18, 2025
@CarolineDenis CarolineDenis changed the base branch from issue-6407 to issue-6409 April 18, 2025 15:53
@CarolineDenis CarolineDenis requested review from sharadsw and a team April 18, 2025 16:33
Copy link
Contributor

@pashiav pashiav 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 two CO records are returned with the parent cat num for the cat num column value
  • Verify that the primary cat num fill the column for the empty ones
  • Verify that the additional filter is applied

Bugs

1. Adding a child CO then Saving causes IntegrityError Column 'PrepTypeID' cannot be null. Children with cat nums are still saved, while children without cat nums are not.

Workflow:

  1. Go to a CO and add a child with/without cat num (https://calvertmarinemuseum20250210migration6410-issue-6410.test.specifysystems.org/specify/view/collectionobject/33058/)
  2. Save record
  3. See error
  4. Refresh and see that the child is saved/not saved

Child with catnum:
Specify 7 Crash Report - 2025-04-24T16_28_14.904Z.txt

Screen.Recording.2025-04-24.at.11.28.09.AM.mov

Child without catnum:
Specify 7 Crash Report - 2025-04-24T16_32_08.006Z.txt

Screen.Recording.2025-04-24.at.11.31.59.AM.mov

System information:
Specify 7 System Information - 2025-04-24T16_37_23.633Z.txt

@CarolineDenis
Copy link
Contributor Author

@pashiav,
Your issue is not linked to this pr, in your Remote Preferences you had: CO_CREATE_PREP_32769=true
So either you remove it or you add the prep to the CO child subview.
But not adding a prep on child and keep CO_CREATE_PREP in your pref will throw an error.

@CarolineDenis CarolineDenis requested review from pashiav and a team April 24, 2025 18:08
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 two CO records are returned with the parent cat num for the cat num column value
  • Verify that the primary cat num fill the column for the empty ones
  • Verify that the additional filter is applied

Works as expected
image

@emenslin emenslin requested a review from a team April 25, 2025 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Dev Attention Needed
Development

Successfully merging this pull request may close these issues.

Parent CO Inheritance: Query Behavior for Catalog Numbers
5 participants