diff --git a/app/controllers/player_controller.rb b/app/controllers/player_controller.rb index eb1a824..597f509 100644 --- a/app/controllers/player_controller.rb +++ b/app/controllers/player_controller.rb @@ -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 diff --git a/app/views/player/show.html.erb b/app/views/player/show.html.erb index 2748dcc..e1a9d74 100644 --- a/app/views/player/show.html.erb +++ b/app/views/player/show.html.erb @@ -38,5 +38,31 @@

Alt Status

<%= @player.name %> is set as an alt of <%= link_to @player.main_name, player_path(@player.main_player) %>

<% end %> + +

Games

+ <% if @games.any? %> +
+
+
Time
+
Wager
+
Winner
+
High Roll
+
Loser
+
Low Roll
+
Payout
+
+ <% @games.each do |game| %> +
+
<%= Time.at(game.timestamp).strftime("%Y-%m-%d %H:%M:%S") %>
+
<%= game.wager %>
+
<%= game.winner %>
+
<%= game.high_roll %>
+
<%= game.loser %>
+
<%= game.low_roll %>
+
<%= game.payout %>
+
+ <% end %> +
+ <% end %> Leaderboard