From 3fe4a331ac4925310cc2a997a9457932a84f930b Mon Sep 17 00:00:00 2001 From: Thelonius Kort Date: Wed, 1 Mar 2023 16:01:14 +0100 Subject: [PATCH] Remove detour over Enum.into(%{}) for keyword results to %Artikel{} --- lib/outlook/public.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/outlook/public.ex b/lib/outlook/public.ex index 5157c7c..3b1474e 100644 --- a/lib/outlook/public.ex +++ b/lib/outlook/public.ex @@ -28,7 +28,7 @@ implement to_param protocol (no more needed for Outlook.Translations.Translation where: t.public == true and t.language == ^language, order_by: [desc: t.date] Repo.all(q) - |> Enum.map(fn rec -> Enum.into(rec, %{}) end) + # |> Enum.map(fn rec -> Enum.into(rec, %{}) end) |> Enum.map(fn map -> struct(Artikel, map) end) end @@ -50,7 +50,7 @@ implement to_param protocol (no more needed for Outlook.Translations.Translation where: t.id == ^id and t.public == true case Repo.one(q) do nil -> {:error, "Artikel does not exist, or isn't public."} - artikel -> {:ok, struct(Artikel, artikel |> Enum.into(%{}))} + artikel -> {:ok, struct(Artikel, artikel)} end end