Skip to content

Commit 02961f9

Browse files
committed
Fix: Use Multi.run for game update in transaction
Changed from Multi.update to Multi.run to properly use the existing update_game function which handles changeset creation. Signed-off-by: immortal71 <newaashish190@gmail.com>
1 parent c0815be commit 02961f9

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • copi.owasp.org/lib/copi_web/live/game_live

copi.owasp.org/lib/copi_web/live/game_live/show.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ defmodule CopiWeb.GameLive.Show do
8484
player_id: Enum.at(players, rem(i, player_count)).id
8585
})
8686
end)
87-
|> Ecto.Multi.update(:start_game,
88-
Copi.Cornucopia.change_game(game, %{started_at: DateTime.truncate(DateTime.utc_now(), :second)}))
87+
|> Ecto.Multi.run(:start_game, fn _repo, _changes ->
88+
Copi.Cornucopia.update_game(game, %{started_at: DateTime.truncate(DateTime.utc_now(), :second)})
89+
end)
8990

9091
# Execute transaction: all cards dealt and game started, or nothing happens
9192
case Copi.Repo.transaction(multi) do

0 commit comments

Comments
 (0)