fix: member.email calculation
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Moritz 2025-08-05 17:38:47 +02:00
parent 2f140e8f10
commit 824a8f7476
Signed by: moritz
GPG key ID: 1020A035E5DD0824
2 changed files with 71 additions and 17 deletions

View file

@ -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