diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index ec766f0..64349bb 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -134,7 +134,7 @@ class TournamentsController < ApplicationController end def matches - @matches = @tournament.matches.sort_by{|m| m.bout_number} + @matches = @tournament.matches.includes(:wrestlers,:schools).sort_by{|m| m.bout_number} if @match @w1 = @match.wrestler1 @w2 = @match.wrestler2 diff --git a/app/models/match.rb b/app/models/match.rb index 03717a7..7e84c38 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -3,6 +3,7 @@ class Match < ActiveRecord::Base belongs_to :weight, touch: true belongs_to :mat, touch: true has_many :wrestlers, :through => :weight + has_many :schools, :through => :wrestlers after_update :after_finished_actions, :if => :saved_change_to_finished? or :saved_change_to_winner_id? or :saved_change_to_win_type? or :saved_change_to_score? def after_finished_actions diff --git a/app/models/weight.rb b/app/models/weight.rb index ff5343e..2f170dc 100644 --- a/app/models/weight.rb +++ b/app/models/weight.rb @@ -10,8 +10,8 @@ class Weight < ActiveRecord::Base # passed via layouts/_tournament-navbar.html.erb # tournaments controller does a .split(',') on this string and creates an array via commas # tournament model runs the code via method create_pre_defined_weights - HS_WEIGHT_CLASSES = "106,113,120,126,132,138,145,152,160,170,182,195,220,285" - HS_GIRLS_WEIGHT_CLASSES = "101,106,111,116,121,126,131,137,143,150,160,170,189,235" + HS_WEIGHT_CLASSES = "106,113,120,126,132,138,144,150,157,165,175,190,215,285." + HS_GIRLS_WEIGHT_CLASSES = "100,105,110,115,120,125,130,135,140,145,155,170,190,235" before_destroy do self.tournament.destroy_all_matches