diff options
author | Elizabeth (Lizzy) Hunt <elizabeth.hunt@simponic.xyz> | 2023-05-29 16:28:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-29 16:28:27 -0700 |
commit | eec32aa38a8762eccc8575a37a628bd5ae2cc1d0 (patch) | |
tree | 27f656780f5d25325c9ac0ec3db3557d774bf414 /lib/chessh/ssh/client/menus/select_current_game.ex | |
parent | 8a5a2f358cb1f63a255b2daf6908536583986448 (diff) | |
download | chessh-eec32aa38a8762eccc8575a37a628bd5ae2cc1d0.tar.gz chessh-eec32aa38a8762eccc8575a37a628bd5ae2cc1d0.zip |
Bots (#23)
* squash all the things for bots
* fix warnings
* change colors a bit and README updates
* fix frontend warnings
Diffstat (limited to 'lib/chessh/ssh/client/menus/select_current_game.ex')
-rw-r--r-- | lib/chessh/ssh/client/menus/select_current_game.ex | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/chessh/ssh/client/menus/select_current_game.ex b/lib/chessh/ssh/client/menus/select_current_game.ex index 3c47b15..7c49a30 100644 --- a/lib/chessh/ssh/client/menus/select_current_game.ex +++ b/lib/chessh/ssh/client/menus/select_current_game.ex @@ -1,6 +1,6 @@ defmodule Chessh.SSH.Client.SelectCurrentGame do alias Chessh.{Utils, Repo, Game, PlayerSession} - alias Chessh.SSH.Client.GameSelector + alias Chessh.SSH.Client.Selector import Ecto.Query require Logger @@ -12,7 +12,7 @@ defmodule Chessh.SSH.Client.SelectCurrentGame do def dynamic_options(), do: true def get_player_sorted_current_games_with_id(player_id, current_id \\ nil, direction \\ :desc) do - GameSelector.paginate_ish_query( + Selector.paginate_ish_query( Game |> where([g], g.status == :continue) |> where([g], g.light_player_id == ^player_id or g.dark_player_id == ^player_id) @@ -20,6 +20,7 @@ defmodule Chessh.SSH.Client.SelectCurrentGame do current_id, direction ) + |> Repo.preload([:light_player, :dark_player, :bot]) end def format_game_selection_tuple(%Game{id: game_id} = game) do @@ -67,7 +68,7 @@ defmodule Chessh.SSH.Client.SelectCurrentGame do order_by: [desc: g.id] ) |> Repo.all() - |> Repo.preload([:light_player, :dark_player]) + |> Repo.preload([:light_player, :dark_player, :bot]) |> Enum.map(&format_game_selection_tuple/1) end @@ -78,7 +79,7 @@ defmodule Chessh.SSH.Client.SelectCurrentGame do previous_last_game_id = case List.last(options) do {_label, id} -> id - _ -> 0 + _ -> 1 end current_screen_games = |