This commit is contained in:
parent
2f140e8f10
commit
824a8f7476
2 changed files with 71 additions and 17 deletions
|
|
@ -11,9 +11,17 @@ defmodule Mv.Membership.MemberEmailCalculation do
|
|||
def calculate(records, _opts, _context) do
|
||||
Enum.map(records, fn record ->
|
||||
case record.user do
|
||||
%{email: user_email} when is_binary(user_email) -> user_email
|
||||
_ -> record.member_email
|
||||
%{email: user_email} ->
|
||||
# Convert Ash.CiString to string if needed
|
||||
if is_struct(user_email, Ash.CiString) do
|
||||
to_string(user_email)
|
||||
else
|
||||
user_email
|
||||
end
|
||||
|
||||
_ ->
|
||||
record.member_email
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue