From eec32aa38a8762eccc8575a37a628bd5ae2cc1d0 Mon Sep 17 00:00:00 2001 From: "Elizabeth (Lizzy) Hunt" Date: Mon, 29 May 2023 16:28:27 -0700 Subject: Bots (#23) * squash all the things for bots * fix warnings * change colors a bit and README updates * fix frontend warnings --- lib/chessh/ssh/client/menus/select_previous_game.ex | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/chessh/ssh/client/menus/select_previous_game.ex') diff --git a/lib/chessh/ssh/client/menus/select_previous_game.ex b/lib/chessh/ssh/client/menus/select_previous_game.ex index 5f55c3d..c348268 100644 --- a/lib/chessh/ssh/client/menus/select_previous_game.ex +++ b/lib/chessh/ssh/client/menus/select_previous_game.ex @@ -1,6 +1,6 @@ defmodule Chessh.SSH.Client.SelectPreviousGame 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.SelectPreviousGame 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.SelectPreviousGame 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.SelectPreviousGame 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.SelectPreviousGame do previous_last_game_id = case List.last(options) do {_label, id} -> id - _ -> 0 + _ -> 1 end current_screen_games = -- cgit v1.2.3-70-g09d2