mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-31 15:06:32 +02:00
Fix subquery in member domains json invitation query to handle multiple invites per email
This commit is contained in:
parent
d3cb401e47
commit
26b24c846c
1 changed files with 4 additions and 1 deletions
|
@ -136,7 +136,10 @@ class PortfolioMembersJson(PortfolioMembersPermission, View):
|
|||
# Use ArrayRemove to return an empty list when no domain invitations are found
|
||||
domain_info=ArrayRemoveNull(
|
||||
ArrayAgg(
|
||||
Subquery(domain_invitations.values("domain_info")),
|
||||
# Use order_by("id")[:1] to limit the subquery to a single row,
|
||||
# otherwise we'll trigger a "more than one row returned by a subquery used as an expression"
|
||||
# when an email matches multiple domain invitations
|
||||
Subquery(domain_invitations.values("domain_info").order_by("id")[:1]),
|
||||
distinct=True,
|
||||
)
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue