Merge pull request #1835 from cisagov/dk/1834-distinct-investigators

Issue #1834 : investigators list in filter shows only distinct values
This commit is contained in:
dave-kennedy-ecs 2024-02-27 11:09:48 -05:00 committed by GitHub
commit 093af61160
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -838,13 +838,19 @@ class DomainApplicationAdmin(ListHeaderAdmin):
)
# 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