def calculate(records, _, _) do
Enum.map(records, fn record ->
cond do
record.checking_account ->
%Ash.Union{type: :checking_account, value: record.checking_account}
record.savings_account ->
%Ash.Union{type: :savings_account, value: record.savings_account}
true ->
nil
end
end)
end
def calculate(records, _, _) do
Enum.map(records, fn record ->
cond do
record.checking_account ->
%Ash.Union{type: :checking_account, value: record.checking_account}
record.savings_account ->
%Ash.Union{type: :savings_account, value: record.savings_account}
true ->
nil
end
end)
end