Skip to content

Bound the arrival acquisition type lookup to one row - #1200

Merged
labkey-martyp merged 1 commit into
release26.7-SNAPSHOTfrom
26.7_fb_rearrival_form_fields
Sep 11, 2026
Merged

Bound the arrival acquisition type lookup to one row#1200
labkey-martyp merged 1 commit into
release26.7-SNAPSHOTfrom
26.7_fb_rearrival_form_fields

Conversation

@labkey-martyp

@labkey-martyp labkey-martyp commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

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

  • Read the acquisition type from the animal's most recent arrival rather than from all of its arrival records at once.

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.

@labkey-martyp labkey-martyp left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated test failures

@labkey-martyp
labkey-martyp merged commit d2d3734 into release26.7-SNAPSHOT Sep 11, 2026
9 of 10 checks passed
@labkey-martyp
labkey-martyp deleted the 26.7_fb_rearrival_form_fields branch September 11, 2026 10:56
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants