Skip to content

Commit

Permalink
fix: Format code.
Browse files Browse the repository at this point in the history
  • Loading branch information
LuchoTurtle committed Nov 8, 2022
1 parent 2642334 commit d601dc0
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions lib/app_web/live/app_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -195,36 +195,35 @@ 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
# - `changeset_to_error`: changeset object that you want to error out
# - `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
Expand Down

0 comments on commit d601dc0

Please sign in to comment.