Bound the arrival acquisition type lookup to one row - #1200
Merged
labkey-martyp merged 1 commit intoSep 11, 2026
Conversation
An animal with more than one arrival record made getObject() throw, so the status recalc failed for any rearrived animal, including when entering its death.
This was referenced Sep 9, 2026
ankurjuneja
approved these changes
Sep 10, 2026
labkey-martyp
commented
Sep 11, 2026
labkey-martyp
left a comment
Contributor
Author
There was a problem hiding this comment.
Unrelated test failures
labkey-martyp
added a commit
to LabKey/nircEHRModules
that referenced
this pull request
Sep 11, 2026
## Rationale The Rearrival form collects fields that do not apply to a returning animal and omits the ones that do, and a completed rearrival leaves the animal in a departed state. It asks for an acquisition type and a CITES number, though an animal that is coming back was already acquired, and it does not ask which project, which protocol or which location the animal returns to. A departure closes the animal's project assignment, protocol assignment and housing records, so a rearrival has to open them again, and it has to put the animal back to Alive. ## Related Pull Requests - LabKey/ehrModules#1200 — needed alongside this change, since entering a death for an animal that has arrived more than once fails without it. ## Changes - Replace acquisition type and CITES on the Rearrival form with project, protocol and location, each required, as they are on the Arrival form. - Open the project assignment, protocol assignment and housing records for a rearrival, matching what an arrival already does. - Return a rearrived animal to Alive once the rearrival is completed. - Add a Selenium test covering the fields the form collects, the records a rearrival opens and the status change.
labkey-martyp
added a commit
to LabKey/nbriEHRModules
that referenced
this pull request
Sep 11, 2026
## Rationale The Rearrival form collects fields that do not apply to a returning animal and omits the ones that do, and a completed rearrival leaves the animal in a departed state. It asks for an acquisition type and a CITES number, though an animal that is coming back was already acquired, and it does not ask which project, protocol, group or location the animal returns to. This reverses the decision in #28 to leave rearrivals out of those assignment fields: a departure closes an animal's project, protocol, group and housing records, so a returning animal has none of them left to keep and each has to be opened again, along with putting the animal back to Alive. ## Related Pull Requests - LabKey/ehrModules#1200 — needed alongside this change, since entering a death for an animal that has arrived more than once fails without it. ## Changes - Replace acquisition type and CITES on the Rearrival form with project, protocol, group and location, each required, as they are on the Arrival form. - Open the project assignment, protocol assignment, group membership and housing records for a rearrival, matching what an arrival already does. - Return a rearrived animal to Alive once the rearrival is completed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale
Any status recalculation for an animal that has arrived more than once fails with a database error instead of saving. The recalculation reads the animal's acquisition type from the arrival dataset filtered only on the animal, which throws as soon as a second arrival row exists. Death entry is the common way to hit this, and it is worst at centers that leave the status to the recalculation rather than writing it directly, where the save and the status are both lost. This surfaced while adding rearrivals to an institution module, but it affects every center whose arrival dataset carries an acquisition type.
Related Pull Requests
Changes