From 181d56f12d879dfe4116888cc6137bd0e1c2b2be Mon Sep 17 00:00:00 2001
From: Jacob Cody Wimer
Date: Wed, 13 Dec 2017 11:12:23 -0500
Subject: [PATCH] Break down wrestlers points on the show page
---
app/controllers/wrestlers_controller.rb | 5 +++--
app/views/wrestlers/show.html.erb | 8 ++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/app/controllers/wrestlers_controller.rb b/app/controllers/wrestlers_controller.rb
index b8526ec..d5390fb 100644
--- a/app/controllers/wrestlers_controller.rb
+++ b/app/controllers/wrestlers_controller.rb
@@ -3,13 +3,14 @@ class WrestlersController < ApplicationController
before_action :check_access, only: [:new,:create,:update,:destroy,:edit,:update_pool]
-
+
# GET /wrestlers/1
# GET /wrestlers/1.json
def show
@school = @wrestler.school
@tournament = @wrestler.tournament
+ @wrestler_points_calc = CalculateWrestlerTeamScore.new(@wrestler)
end
# GET /wrestlers/new
@@ -104,7 +105,7 @@ class WrestlersController < ApplicationController
def set_wrestler
@wrestler = Wrestler.where(:id => params[:id]).includes(:school, :weight, :tournament, :matches).first
end
-
+
# Never trust parameters from the scary internet, only allow the white list through.
def wrestler_params
params.require(:wrestler).permit(:name, :school_id, :weight_id, :seed, :original_seed, :season_win, :season_loss,:criteria,:extra,:offical_weight,:pool)
diff --git a/app/views/wrestlers/show.html.erb b/app/views/wrestlers/show.html.erb
index b71b3b8..67d46e9 100644
--- a/app/views/wrestlers/show.html.erb
+++ b/app/views/wrestlers/show.html.erb
@@ -33,6 +33,14 @@
Total Team Points Scored:
<%= @wrestler.totalTeamPoints %>
+
+ Points Breakdown:
+ Pool Win Points (including BYE points): <%= @wrestler_points_calc.poolPoints %>
+ Bracket Win Points: <%= @wrestler_points_calc.bracketPoints %>
+ Bonus Points: <%= @wrestler_points_calc.bonusWinPoints %>
+ Placement Points:<%= @wrestler_points_calc.placementPoints %>
+
+