We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug If the aggregated resource has a default preparation that will load other resources, the aggregation will fail
To Reproduce First we have a resource with these aggregations and relationships:
aggregates do count :total_students, :students count :total_classes, :classes end relationships do alias Core.Feedbacks has_many :classes, Feedbacks.Class has_many :students, Feedbacks.Student end
And in the Class resource, we have the following preparations:
Class
preparations do prepare build(load: [:students]) end
Now, if we try to load :total_classes we will get the following error:
:total_classes
iex(18)> Core.Feedbacks.read!(Core.Feedbacks.School) |> List.first |> Core.Feedbacks.load([:total_classes]) [debug] QUERY OK source="schools" db=0.3ms idle=795.8ms SELECT s0."id", s0."name", s0."inserted_at", s0."updated_at", s0."organization_id" FROM "schools" AS s0 [] {:error, %Ash.Error.Unknown{ errors: [ %Ash.Error.Unknown.UnknownError{ error: "Cannot load in an aggregate.", field: nil, changeset: nil, query: nil, error_context: ["Loading aggregate: :total_classes for query: #Ash.Query<resource: Core.Feedbacks.School>"], vars: [], path: [:aggregates], stacktrace: #Stacktrace<>, class: :unknown } ], stacktraces?: true, changeset: nil, query: nil, error_context: [], vars: [], path: [], stacktrace: #Stacktrace<>, class: :unknown }}
Expected behavior The aggregation should work and the preparations of the other resource should be ignored.
Runtime
The text was updated successfully, but these errors were encountered:
3ee3279
1.3.2
~> 2.16.1
No branches or pull requests
Describe the bug
If the aggregated resource has a default preparation that will load other resources, the aggregation will fail
To Reproduce
First we have a resource with these aggregations and relationships:
And in the
Class
resource, we have the following preparations:Now, if we try to load
:total_classes
we will get the following error:Expected behavior
The aggregation should work and the preparations of the other resource should be ignored.
Runtime
The text was updated successfully, but these errors were encountered: