CDCgov / prime-simplereport

SimpleReport is a fast, free, and easy way for COVID-19 testing facilities to report results to public health departments.
https://simplereport.gov
Creative Commons Zero v1.0 Universal
58 stars 53 forks source link

[Bug] Facility deletion modal incorrectly counting number of users assigned #7873

Open mehansen opened 5 months ago

mehansen commented 5 months ago

Description

When I go to delete a facility, I get a confirmation modal explaining what will happen with users and patients that only have access to that facility (potentially orphaned users/patients). The modal is providing the wrong value for number of users only added to the facility.

Steps to reproduce

In dev4, org Bray and Morse Trading has 2 facilities and 3 users: 1 user has all facilities access as an admin and 2 are standard users with access to both facilities. When I use the support admin dashboard Manage facility tool to delete one of the facilities, the confirmation modal says "There are 2 users and 0 patients added only to this facility." This is incorrect. I would expect the modal to say that there are no users added only to this facility.

Screenshot 2024-07-01 at 9 22 24 AM

Expected behavior

The modal should provide the value for users only added to a specific facility and that value should reflect the number of users that have access to the facility to be deleted and no other facility.

Additional context

Looks like getUsersInSingleFacility is written to get count of users total in that facility group when the logic is actually a little more complex.

If developing a query for this ticket is too involved/not performant, work with Jayna to come up with copy and we'll just use the existing query to give the value of all users in the facility.

jayna-SkylightDigital commented 5 months ago

@jayna-SkylightDigital