Add games to players

This commit is contained in:
2025-02-03 15:29:47 -08:00
parent 181e878316
commit eecdae6c16
2 changed files with 30 additions and 0 deletions

View File

@@ -1,5 +1,9 @@
class PlayerController < ApplicationController
def show
@player = Player.find(params[:id])
@games = Game.where(winner: @player.name).or(Game.where(loser: @player.name))
@player.alternate_players.each do |alt|
@games += Game.where(winner: alt.name).or(Game.where(loser: alt.name))
end
end
end