-
Notifications
You must be signed in to change notification settings - Fork 36
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
Conversation
Triggered by 64c8deb on branch refs/heads/issue-5461
Hold off on testing for now, found another bug. |
ready for testing @specify/testing @specify/ux-testing |
Approved as a temp fix :) |
There was a problem hiding this 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?
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 Thanks for noticing those blank CO records. This issue should be fixed now when doing clone and bulk carry. |
There was a problem hiding this 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!
There was a problem hiding this 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👍👍👍
Closed in favor of #6018 |
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-explanatory (or properly documented)
Testing instructions
Test Cloning:
Test Deleting parentCog: