calculations do
calculate :subtotal,
:decimal,
expr(
type(price, :decimal) * type(quantity, :decimal) + type(modifiers_total, :decimal)
)
end
aggregates do
sum :modifiers_total, :modifiers, :total, public?: true
end
If a particular record doesn’t have modifiers
then subtotal
ends up being nil, how do I default the result of the aggregate to "0"
instead of nil
?