diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb index 68317c3..4927f15 100644 --- a/app/controllers/static_pages_controller.rb +++ b/app/controllers/static_pages_controller.rb @@ -4,8 +4,24 @@ class StaticPagesController < ApplicationController @tournaments = Tournament.all end - def school - @school = School.all + def brackets + if params[:weight] + @weight = Weight.find(params[:weight]) + @wrestlers = Wrestler.where(weight_id: @weight.id) + @seed1 = Wrestler.where(weight_id: @weight.id, original_seed: 1).first + end + #@seed1 = @wrestlers.where(original_seed: 1).name + + + end + + def weights + if params[:tournament] + @tournament = Tournament.find(params[:tournament]) + end + if @tournament + @weights = Weight.where(tournament_id: @tournament.id) + end end end diff --git a/app/models/school.rb b/app/models/school.rb index 3a89241..dee553a 100644 --- a/app/models/school.rb +++ b/app/models/school.rb @@ -1,4 +1,13 @@ class School < ActiveRecord::Base belongs_to :tournament has_many :wrestlers, dependent: :destroy + + #calculate score here + #def score + # @score = 0 + # self.wrestlers.each do |w| + # @score = @score + w.season_win * 2 + # end + # self.score = @score + #end end diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index d591e25..56fa9d4 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -6,7 +6,7 @@