Skip to content

Commit

Permalink
Merge pull request #1835 from cisagov/dk/1834-distinct-investigators
Browse files Browse the repository at this point in the history
Issue #1834 : investigators list in filter shows only distinct values
  • Loading branch information
dave-kennedy-ecs authored Feb 27, 2024
2 parents 1cfb495 + 52824c7 commit 093af61
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/registrar/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,13 +838,19 @@ def lookups(self, request, model_admin):
)

# Annotate the full name and return a values list that lookups can use
privileged_users_annotated = privileged_users.annotate(
full_name=Coalesce(
Concat("investigator__first_name", Value(" "), "investigator__last_name", output_field=CharField()),
"investigator__email",
output_field=CharField(),
privileged_users_annotated = (
privileged_users.annotate(
full_name=Coalesce(
Concat(
"investigator__first_name", Value(" "), "investigator__last_name", output_field=CharField()
),
"investigator__email",
output_field=CharField(),
)
)
).values_list("investigator__id", "full_name")
.values_list("investigator__id", "full_name")
.distinct()
)

return privileged_users_annotated

Expand Down

0 comments on commit 093af61

Please sign in to comment.