Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Apr 17, 2024
1 parent 45b66f5 commit 28136ec
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 31 deletions.
1 change: 0 additions & 1 deletion lib/ash/actions/update/bulk.ex
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ defmodule Ash.Actions.Update.Bulk do
authorize_atomic_changeset(query, atomic_changeset, opts),
{query, atomic_changeset} <- add_changeset_filters(query, atomic_changeset),
{:ok, data_layer_query} <- Ash.Query.data_layer_query(query) do

case Ash.DataLayer.update_query(
data_layer_query,
atomic_changeset,
Expand Down
60 changes: 31 additions & 29 deletions lib/ash/changeset/changeset.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2109,43 +2109,45 @@ defmodule Ash.Changeset do
Enum.reduce(
changeset.atomics,
changeset,
fn {_key,
%Ash.Query.Function.Error{
arguments: arguments
} = error}, changeset ->
Enum.reduce_while(arguments, {:ok, []}, fn argument, {:ok, args} ->
case Ash.Expr.eval(argument,
resource: changeset.resource,
unknown_on_unknown_refs?: true
) do
{:ok, value} ->
{:cont, {:ok, [value | args]}}

_ ->
{:halt, :error}
end
end)
|> case do
{:ok, args} ->
error = %{error | arguments: args}

case Ash.Expr.eval(error,
fn
{_key,
%Ash.Query.Function.Error{
arguments: arguments
} = error},
changeset ->
Enum.reduce_while(arguments, {:ok, []}, fn argument, {:ok, args} ->
case Ash.Expr.eval(argument,
resource: changeset.resource,
unknown_on_unknown_refs?: true
) do
{:error, error} ->
Ash.Changeset.add_error(changeset, error)
{:ok, value} ->
{:cont, {:ok, [value | args]}}

_ ->
changeset
{:halt, :error}
end
end)
|> case do
{:ok, args} ->
error = %{error | arguments: args}

_ ->
changeset
end
case Ash.Expr.eval(error,
resource: changeset.resource,
unknown_on_unknown_refs?: true
) do
{:error, error} ->
Ash.Changeset.add_error(changeset, error)

{_key, _value}, changeset ->
changeset
_ ->
changeset
end

_ ->
changeset
end

{_key, _value}, changeset ->
changeset
end
)
else
Expand Down
2 changes: 1 addition & 1 deletion lib/ash/filter/filter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3509,7 +3509,7 @@ defmodule Ash.Filter do
end

{:ok, right} ->
{:ok, %{expr | left: left, right: right}}
{:ok, %{expr | left: left, right: right}}
end
end
end
Expand Down

0 comments on commit 28136ec

Please sign in to comment.