mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +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}])
|
|> Enum.concat([%{path: path, type: :calculation, calculation: calculation}])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
%Ash.Query.Aggregate{} = aggregate ->
|
||||||
|
[%{path: path, type: :aggregate, aggregate: aggregate}]
|
||||||
|
|
||||||
other ->
|
other ->
|
||||||
cond do
|
cond do
|
||||||
Ash.Resource.Info.aggregate(query.resource, other) ->
|
Ash.Resource.Info.aggregate(query.resource, other) ->
|
||||||
|
|
|
@ -98,7 +98,6 @@ defmodule Ash.Resource.Calculation.Expression do
|
||||||
aggs_from_this_calc =
|
aggs_from_this_calc =
|
||||||
expression
|
expression
|
||||||
|> Ash.Filter.used_aggregates()
|
|> Ash.Filter.used_aggregates()
|
||||||
|> Enum.map(& &1.name)
|
|
||||||
|
|
||||||
aggs_from_calcs =
|
aggs_from_calcs =
|
||||||
further_calculations
|
further_calculations
|
||||||
|
@ -117,15 +116,12 @@ defmodule Ash.Resource.Calculation.Expression do
|
||||||
}
|
}
|
||||||
) do
|
) do
|
||||||
{:ok, expression} ->
|
{:ok, expression} ->
|
||||||
expression
|
Ash.Filter.used_aggregates(expression)
|
||||||
|> Ash.Filter.used_aggregates()
|
|
||||||
|> Enum.map(& &1.name)
|
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|> Enum.map(& &1.name)
|
|
||||||
|
|
||||||
Enum.uniq(aggs_from_calcs ++ aggs_from_this_calc)
|
Enum.uniq(aggs_from_calcs ++ aggs_from_this_calc)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue