Skip to content
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

Add/Edit handling of 'one-to-one' relationship cases in resourceApi #5509

Closed
wants to merge 12 commits into from

Conversation

acwhite211
Copy link
Member

@acwhite211 acwhite211 commented Dec 20, 2024

Fixes #5461
Fixes #5463

Mimic the functionality of 'many-to-one' relationship handling in the 'resourceApi.ts' file for the 'one-to-one' relationships. This works since 'one-to-one' relationships are essentially the same as 'many-to-one' relationships, just with a uniqueness constraint on the foreign key.

Also, this PR handles the case where a childCo of a COJO record is trying to be saved before the CO is created, and thus yet to have a record ID. It's a temporary solution for now, a more general solution for handling the order of saving database records will be needed in the future.

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

Testing instructions

Test Cloning:

  • Select a CO form and add a parentCog to it in the Cojo subform.
  • Save the CO
  • Press the Clone button (no errors occur)
  • Verify that you can save the new cloned CO and that the parent is present
  • Verify it works for carry forward
  • Verify it works for bulk carry

Test Deleting parentCog:

  • Use on of the existing CO you just created with a parentCog. Open up the CO form.
  • Within the Cojo sub-form, delete the text in the parentCog textbox.
  • Press the minus button next to Cojo.
  • Press "Save", no errors should occur

@acwhite211 acwhite211 added this to the 7.9.11 milestone Dec 20, 2024
@acwhite211 acwhite211 marked this pull request as draft December 20, 2024 18:14
@acwhite211
Copy link
Member Author

Hold off on testing for now, found another bug.

@acwhite211 acwhite211 self-assigned this Dec 20, 2024
@CarolineDenis CarolineDenis requested a review from a team December 20, 2024 21:00
@acwhite211 acwhite211 marked this pull request as ready for review December 20, 2024 21:00
@acwhite211
Copy link
Member Author

ready for testing @specify/testing @specify/ux-testing

@CarolineDenis
Copy link
Contributor

Approved as a temp fix :)

Copy link
Collaborator

@combs-a combs-a 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

Test Cloning:

  • Select a CO form and add a parentCog to it in the Cojo subform.
  • Save the CO
  • Press the Clone button (no errors occur)
  • Verify that you can save the new cloned CO and that the parent is present
  • Verify it works for carry forward
  • Verify it works for bulk carry

Test Deleting parentCog:

  • Use one of the existing CO you just created with a parentCog. Open up the CO form.
  • Within the Cojo sub-form, delete the text in the parentCog textbox.
  • Press the minus button next to Cojo.
  • Press "Save", no errors should occur

There's no error on bulk carry, but it appears that both bulk carry and clone are creating extra, blank collection objects?

image

Checked to see if any blank collection objects were in the database (ojsmnh_2024_10_03wb) before but there were not, and issue doesn't occur when you clone/carry/bulk carry a record without a COJO.

blankcojo.mp4

(Only caught it because I got a 404 error on the first carry forward I did and needed to check the records that were created 😅 )

@combs-a combs-a requested a review from a team December 20, 2024 22:35
@acwhite211
Copy link
Member Author

@combs-a Thanks for noticing those blank CO records. This issue should be fixed now when doing clone and bulk carry.

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.

  • Select a CO form and add a parentCog to it in the Cojo subform.

  • Save the CO

  • Press the Clone button (no errors occur)

  • Verify that you can save the new cloned CO and that the parent is present

  • Verify it works for carry forward

  • Verify it works for bulk carry

  • Use on of the existing CO you just created with a parentCog. Open up the CO form.

  • Within the Cojo sub-form, delete the text in the parentCog textbox.

  • Press the minus button next to Cojo.

  • Press "Save", no errors should occur

Looks good!

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

Test Cloning:

  • Select a CO form and add a parentCog to it in the Cojo subform.
  • Save the CO
  • Press the Clone button (no errors occur)
  • Verify that you can save the new cloned CO and that the parent is present
  • Verify it works for carry forward
  • Verify it works for bulk carry

Test Deleting parentCog:

  • Use on of the existing CO you just created with a parentCog. Open up the CO form.
  • Within the Cojo sub-form, delete the text in the parentCog textbox.
  • Press the minus button next to Cojo.
  • Press "Save", no errors should occur

Anya's issue is solved for me

Everything else seems good as well👍👍👍

@CarolineDenis
Copy link
Contributor

Closed in favor of #6018

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
6 participants