Skip to content

Filter cagemates to current public housing and guard null locations - #747

Open
labkey-martyp wants to merge 2 commits into
release26.7-SNAPSHOTfrom
26.7_fb_cagemates_current_housing
Open

Filter cagemates to current public housing and guard null locations#747
labkey-martyp wants to merge 2 commits into
release26.7-SNAPSHOTfrom
26.7_fb_cagemates_current_housing

Conversation

@labkey-martyp

Copy link
Copy Markdown
Contributor

Rationale

The cagemates demographics query could report animals as current cagemates when they were not. The joined housing row was filtered only on the animal being alive, so housing records that had already ended, and records still in a non-public QC state, counted toward both the cagemate list and the total. Separately, a housing row whose location does not resolve through the cage lookup carries no location at all — 101 such rows exist in the container we checked — and those need to be excluded deliberately rather than left to drop out of the results as a side effect of null comparison.

Related Pull Requests

None.

Changes

  • Apply the same current-housing and public-QC-state filters to both sides of the cagemates self-join, so only housing that is genuinely open and visible contributes.

  • Exclude housing rows with no resolved location, so they cannot collapse into one shared facility-wide group.

  • Drop a redundant room comparison, since room is derived from the location key and adds nothing once the locations match.

The joined housing row was never filtered for end date or QC state, so closed and In Progress rows counted as current cagemates. Housing rows whose location never resolved are now excluded rather than grouped together.
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.

1 participant