Nested aggregates and calculations
I have a calculation that looks like this conceptually:
Can a calculation refer to an aggregate that filters by a calculation (that refers to an aggregate)? If it should be possible, the issue is illustrated here: https://gist.github.com/ahey/2c3fcb0dd215f3a82620563e96344949
6 Replies
I believe it should work, yes.
This will be pretty hard to debug without a reproduction. Would you be able to reproduce in ash_postgres tests?
Thanks, good to know it should work. I have submitted a PR that reproduces the issue here: https://github.com/ash-project/ash_postgres/pull/164
GitHub
test: add failing test to demonstrate potential bug by ahey ยท Pull ...
test complex calculation (AshPostgres.Test.ComplexCalculationsTest)
test/complex_calculations_test.exs:5
** (RuntimeError) Error while building reference: latest_documentation_status
code: |> As...
man, this one was tough
Had to put my brain in a blender for this one ๐
Try
main
of ash_postgres
when you get the chance ๐OK this is brilliant, thank you! It gives me confidence that I can continue to build up calculations and aggregates and they will be composable.
Yep! The only main thing is that aggregates can't point at other aggregates currently
but they can point at calculations, which can just be references to aggregates
its pretty hacky
but doable ๐
Ok good to know, and that there's a workaround ๐