mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 05:23:03 +12:00
fix: handle inline aggregates in calculation resolver
This commit is contained in:
parent
456588bd07
commit
83b29f7bbd
2 changed files with 4 additions and 5 deletions
|
@ -2107,6 +2107,9 @@ defmodule Ash.Actions.Read do
|
|||
|> Enum.concat([%{path: path, type: :calculation, calculation: calculation}])
|
||||
end
|
||||
|
||||
%Ash.Query.Aggregate{} = aggregate ->
|
||||
[%{path: path, type: :aggregate, aggregate: aggregate}]
|
||||
|
||||
other ->
|
||||
cond do
|
||||
Ash.Resource.Info.aggregate(query.resource, other) ->
|
||||
|
|
|
@ -98,7 +98,6 @@ defmodule Ash.Resource.Calculation.Expression do
|
|||
aggs_from_this_calc =
|
||||
expression
|
||||
|> Ash.Filter.used_aggregates()
|
||||
|> Enum.map(& &1.name)
|
||||
|
||||
aggs_from_calcs =
|
||||
further_calculations
|
||||
|
@ -117,15 +116,12 @@ defmodule Ash.Resource.Calculation.Expression do
|
|||
}
|
||||
) do
|
||||
{:ok, expression} ->
|
||||
expression
|
||||
|> Ash.Filter.used_aggregates()
|
||||
|> Enum.map(& &1.name)
|
||||
Ash.Filter.used_aggregates(expression)
|
||||
|
||||
_ ->
|
||||
[]
|
||||
end
|
||||
end)
|
||||
|> Enum.map(& &1.name)
|
||||
|
||||
Enum.uniq(aggs_from_calcs ++ aggs_from_this_calc)
|
||||
|
||||
|
|
Loading…
Reference in a new issue