in my resource, I have 2 calculations that return a kind of state, so I'm using the
:atom
:atom
type and also define
one_of: [:foo, :bar]
one_of: [:foo, :bar]
constraints on the calculation
now when I'm sorting it will just sort it alphabetically, but I'd rather sort it logically, for example in the validity state that I have, I want the records to be sorted in the order
not yet
not yet
,
valid
valid
,
expired
expired
.
is there an Ash-Way ™ of doing this? or do I have to use prefixes or some other trick?
Solution
I would just add a calculation with an expr that turns the atoms into a numeric value, then you can sort on the calculation
The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.