Skip to content

fix(api): guard contacts without a usual place of residence on the follow-up dashboard - #22

Merged
lbrunofidelis merged 2 commits into
homologacaofrom
dev
Sep 1, 2026
Merged

lbrunofidelis merged 2 commits into
homologacaofrom
dev

Conversation

@lbrunofidelis

Copy link
Copy Markdown
Collaborator

Promotes dev into homologacao.

The only delta is the follow-up dashboard fix, already merged into dev.

What changes

FollowUp.getOrCountGroupedByPerson no longer dereferences the usual place of residence lookup without checking it first. A contact that has addresses but none of type usual place of residence made addresses.find(...) return undefined, and reading locationId off it returned a 500 for the whole request, on both passes of the post-processing.

Such a contact became possible once the notification address type was introduced, so the dashboard broke for every user as soon as one contact carried only a notification address.

Contacts without a usual place of residence are now listed without a resolved location. Contacts that do have one still get their location resolved.

Scope

One file, API only. No migrations, no dependency changes. The FrontEnd needs no promotion.

Validation

Reproduced against a local database holding a contact whose only address is a notification address and who owns the outbreak's only follow-up, calling the method the same way the remote method does.

Before the fix:

RESULT: FAILED
error name: TypeError
error message: Cannot read properties of undefined (reading 'locationId')

After the fix, on the same data plus a seeded contact that does have a usual place of residence:

RESULT: OK
groups returned: 2
  CO-ZZTEST01     | addresses: [USUAL_PLACE_OF_RESIDENCE] | follow-ups: 1 | location resolved: true
  CO-0000000005   | addresses: [NOTIFICATION]             | follow-ups: 1 | location resolved: false

To confirm after deploy: open Sidebar > Follow-ups > dashboard on the homologacao instance and check it loads instead of returning a 500.

The follow-up dashboard crashed with a 500 whenever a contact had
addresses but none of them was a usual place of residence, which is
possible for contacts that only carry a notification address.
…notification-only-address

fix(api): guard contacts without a usual place of residence on the follow-up dashboard
@lbrunofidelis
lbrunofidelis merged commit 924562e into homologacao Sep 1, 2026
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