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

logical lock for the_SEEDLOT #1308

Closed
2 tasks
SLDonnelly opened this issue Jul 2, 2024 · 2 comments · Fixed by #1455
Closed
2 tasks

logical lock for the_SEEDLOT #1308

SLDonnelly opened this issue Jul 2, 2024 · 2 comments · Fixed by #1455
Assignees

Comments

@SLDonnelly
Copy link
Collaborator

SLDonnelly commented Jul 2, 2024

Describe the task
When updating SEEDLOT related data (i,e. child tables such a parent trees) it is a good idea to logically lock the SEEDLOT. For example, if two users are editing parent tree contribution and are unaware of one another, both could save their data (because the code is only looking at revision count on the parent tree records). The parent tree contribution could become a mess if that occurs. To prevent such issues it is typical to "touch" the seedlot record after all parent trees are updated. If the touch succeeds then commit everything and if it fails (0 rows updated) then rollback everything.

The touch is just

UPDATE seedlot
SET update_userid = :user
, update_timestamp = SYSTIMESTAMP
, revision_count = revision_count + 1
WHERE seedlot_number = :lot_number
AND revision_count = :revision_count_selected;

CC @ronrobb

Acceptance Criteria

  • tested by developer
  • merged
@SLDonnelly SLDonnelly assigned SLDonnelly and RMCampos and unassigned SLDonnelly Jul 2, 2024
@SLDonnelly
Copy link
Collaborator Author

RO from 32

@RMCampos
Copy link
Contributor

RMCampos commented Jul 26, 2024

Notes:

  • Non TSC Admin users can't edit/update a seedlot (or its child tables). The main Seedlot table is firstly touched when the user starts the Seedlot registration, in the Create A-class seedlot page, after clicking the Create seedlot number button. After that, no updates on the seedlot table or on the child tables will happen, until the user finishes the registration and submits the complete form.
  • After submission (with SUB status), users cannot update or touch the seedlot details.
  • After submission (with SUB status), only TSC Admin users can edit (update) the seedlot record and its child tables, through the Review Form. The regular form allows only read, no changes, even for TSC Admin users.
  • When a TSC Admin user is editing the review form, when saving the editing (not approving or disapproving, only saving), the seedlot table will be updated, along with all child tables.

🤦 For an unknown reason, Hibernate is updating the Seedlot table twice. I'm working on it, to understand why and disable this feature/bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment