Skip to content

Commit 890fac0

Browse files
committed
fix: ensure aggregates are unique by name before adding
1 parent 017f8d5 commit 890fac0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/aggregate.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ defmodule AshSql.Aggregate do
6868
)
6969

7070
{already_computed_aggregates, remaining_aggregates} =
71-
Enum.split_with(aggregates, &already_added?(&1, query.__ash_bindings__, []))
71+
aggregates
72+
|> Enum.uniq_by(& &1.name)
73+
|> Enum.split_with(&already_added?(&1, query.__ash_bindings__, []))
7274

7375
query =
7476
if Enum.any?(already_computed_aggregates) do

0 commit comments

Comments
 (0)