Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
rorymckinley committed Dec 10, 2024
1 parent be54aaa commit 1044631
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/lightning/work_orders.ex
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ defmodule Lightning.WorkOrders do

defp try_put_snapshot(changeset, attrs) do
if snapshot = attrs |> Map.get(:snapshot) do
changeset |> put_assoc(:snapshot, snapshot)
put_assoc(changeset, :snapshot, snapshot)
else
snapshot = Snapshot.get_current_for(attrs[:workflow])
changeset |> put_assoc(:snapshot, snapshot)
put_assoc(changeset, :snapshot, snapshot)
end
end

Expand Down
6 changes: 2 additions & 4 deletions lib/lightning/workflows/snapshot.ex
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,8 @@ defmodule Lightning.Workflows.Snapshot do
@spec include_latest_snapshot(Multi.t(), binary() | :snapshot, Workflow.t()) ::
Multi.t()
def include_latest_snapshot(multi, name \\ :snapshot, workflow) do
get_snapshot = fn repo, _changes ->
Multi.run(multi, name, fn repo, _changes ->
{:ok, get_current_query(workflow) |> repo.one()}
end

multi |> Multi.run(name, get_snapshot)
end)
end
end

0 comments on commit 1044631

Please sign in to comment.