Skip to content

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

Merged
CarolineDenis merged 8 commits into
issue-6409from
issue-6410
Apr 28, 2025
Merged

Add parent cat num to empty child cat num if pref true in QB#6419
CarolineDenis merged 8 commits into
issue-6409from
issue-6410

Conversation

@CarolineDenis

@CarolineDenis CarolineDenis commented Apr 15, 2025

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

! todo:
adapt pr with inheritance for COG primary CO

@sharadsw sharadsw left a comment

Copy link
Copy Markdown
Contributor

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?

Comment thread .env
@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 a team and sharadsw April 18, 2025 16:33

@pashiav pashiav left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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 a team and pashiav April 24, 2025 18:08

@emenslin emenslin left a comment

Copy link
Copy Markdown
Collaborator

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

@pashiav pashiav left a comment

Copy link
Copy Markdown
Contributor

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

Looks good! Preference is working as expected.

@CarolineDenis
CarolineDenis merged commit 65d1531 into issue-6409 Apr 28, 2025
@CarolineDenis
CarolineDenis deleted the issue-6410 branch April 28, 2025 13:31
@github-project-automation github-project-automation Bot moved this from Dev Attention Needed to ✅Done in General Tester Board Apr 28, 2025
@CarolineDenis CarolineDenis mentioned this pull request May 12, 2025
6 tasks
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.

Parent CO Inheritance: Query Behavior for Catalog Numbers

5 participants