From d601dc0863feef976285257883a815acca323258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Arteiro?= Date: Tue, 8 Nov 2022 09:18:48 +0000 Subject: [PATCH] fix: Format code. --- lib/app_web/live/app_live.ex | 39 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/lib/app_web/live/app_live.ex b/lib/app_web/live/app_live.ex index 0b9ac65d..0a41ceae 100644 --- a/lib/app_web/live/app_live.ex +++ b/lib/app_web/live/app_live.ex @@ -195,7 +195,6 @@ defmodule AppWeb.AppLive do end end - # Errors a specific changeset from a list of changesets and returns the updated list of changesets. # You should pass a: # - `timer_changeset_list: list of timer changesets to be updated @@ -203,28 +202,28 @@ defmodule AppWeb.AppLive do # - `changeset_index`: changeset object index inside the list of timer changesets # - `changeset_error_key`: atom key of the changeset object you want to associate the error message # - `changeset_error_message`: the string message to error the changeset key with. - @doc false - defp error_timer_changeset( - timer_changeset_list, + @doc false + defp error_timer_changeset( + timer_changeset_list, + changeset_to_error, + changeset_index, + changeset_error_key, + changeset_error_message + ) do + # Adding error to changeset + errored_changeset = + Ecto.Changeset.add_error( changeset_to_error, - changeset_index, changeset_error_key, changeset_error_message - ) do - # Adding error to changeset - errored_changeset = - Ecto.Changeset.add_error( - changeset_to_error, - changeset_error_key, - changeset_error_message - ) - - {_reply, errored_changeset} = - Ecto.Changeset.apply_action(errored_changeset, :update) - - # Updated list with errored changeset - List.replace_at(timer_changeset_list, changeset_index, errored_changeset) - end + ) + + {_reply, errored_changeset} = + Ecto.Changeset.apply_action(errored_changeset, :update) + + # Updated list with errored changeset + List.replace_at(timer_changeset_list, changeset_index, errored_changeset) + end @impl true def handle_info(%Broadcast{event: "update", payload: _message}, socket) do