Repository navigation
fix(api): guard contacts without a usual place of residence on the follow-up dashboard - #22
Merged
Merged
Conversation
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
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.
Promotes
devintohomologacao.The only delta is the follow-up dashboard fix, already merged into
dev.What changes
FollowUp.getOrCountGroupedByPersonno 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 madeaddresses.find(...)returnundefined, and readinglocationIdoff 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:
After the fix, on the same data plus a seeded contact that does have a usual place of residence:
To confirm after deploy: open Sidebar > Follow-ups > dashboard on the homologacao instance and check it loads instead of returning a 500.