Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions test/aggregate_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@

attributes do
uuid_primary_key(:id)
attribute(:min_score, :integer)
end

relationships do
Expand All @@ -146,6 +147,7 @@

aggregates do
max(:highest_score, :comments, :score)
count(:high_score_comments, :comments, filter: expr(score >= parent(min_score)))
end

actions do
Expand Down Expand Up @@ -178,6 +180,13 @@
)
end

test "a parent in a nested aggregate filter does not prevent grouping" do

Check failure on line 183 in test/aggregate_test.exs

View workflow job for this annotation

GitHub Actions / ash-ci / mix test

test a parent in a nested aggregate filter does not prevent grouping (AshSql.AggregateTest)
query = Ash.Query.filter(Post, high_score_comments > 0)
{:ok, aggregate} = Ash.Query.Aggregate.new(Post, :matching_posts, :count, query: query)

assert AshSql.Aggregate.can_group?(Post, aggregate, %Ecto.Query{})
end

describe "resource_aggregate_to_aggregate/3" do
test "passes actor and tenant to the related read which may require an actor" do
actor = %{id: Ash.UUID.generate()}
Expand Down
Loading