From 633ae2eb01e5987cd609ff44367eb4dd35d935cd Mon Sep 17 00:00:00 2001 From: jcwimer Date: Tue, 17 Nov 2015 13:53:00 +0000 Subject: [PATCH] Modified wrestler show to show matches and team points scored --- app/controllers/wrestlers_controller.rb | 2 +- app/views/wrestlers/show.html.erb | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/controllers/wrestlers_controller.rb b/app/controllers/wrestlers_controller.rb index 7a8cf5d..61d867b 100644 --- a/app/controllers/wrestlers_controller.rb +++ b/app/controllers/wrestlers_controller.rb @@ -79,7 +79,7 @@ class WrestlersController < ApplicationController private # Use callbacks to share common setup or constraints between actions. def set_wrestler - @wrestler = Wrestler.where(:id => params[:id]).includes(:tournament,:school,:weight).first + @wrestler = Wrestler.where(:id => params[:id]).includes(:tournament,:school,:weight,:matches).first end # Never trust parameters from the scary internet, only allow the white list through. diff --git a/app/views/wrestlers/show.html.erb b/app/views/wrestlers/show.html.erb index 52f3efe..22ef6c8 100644 --- a/app/views/wrestlers/show.html.erb +++ b/app/views/wrestlers/show.html.erb @@ -12,16 +12,22 @@

School: - <%= School.find(@wrestler.school_id).name %> + <%= @wrestler.school.name %>

Weight: - <%= Weight.find(@wrestler.weight_id).max %> + <%= @wrestler.weight.max %>

- Original seed: - <%= @wrestler.original_seed %> + Team Points Scored: + <%= @wrestler.totalTeamPoints - @wrestler.totalDeductedPoints %>

+
+
+ +<% @wrestler.allMatches.each do |m| %> +
Bout: <%= m.bout_number %> <%= m.bracket_position %> <%= m.wrestler1.name %> vs. <%= m.wrestler2.name %> <%= m.bracketScore %>
+<% end %>