diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb index e9265c6..ac6f381 100644 --- a/app/controllers/static_pages_controller.rb +++ b/app/controllers/static_pages_controller.rb @@ -25,24 +25,10 @@ class StaticPagesController < ApplicationController if params[:weight] @weight = Weight.find(params[:weight]) @tournament = Tournament.find(@weight.tournament_id) - @wrestlers = Wrestler.where(weight_id: @weight.id) - @bracket_size = Wrestler.where(weight_id: @weight.id).count - @seed1 = Wrestler.where(weight_id: @weight.id, original_seed: 1).first - @seed10 = Wrestler.where(weight_id: @weight.id, original_seed: 10).first - @seed7 = Wrestler.where(weight_id: @weight.id, original_seed: 7).first - @seed5 = Wrestler.where(weight_id: @weight.id, original_seed: 5).first - @seed4 = Wrestler.where(weight_id: @weight.id, original_seed: 4).first - @seed2 = Wrestler.where(weight_id: @weight.id, original_seed: 2).first - @seed9 = Wrestler.where(weight_id: @weight.id, original_seed: 9).first - @seed6 = Wrestler.where(weight_id: @weight.id, original_seed: 6).first - @seed8 = Wrestler.where(weight_id: @weight.id, original_seed: 8).first - @seed3 = Wrestler.where(weight_id: @weight.id, original_seed: 3).first - @seed11 = Wrestler.where(weight_id: @weight.id, original_seed: 11).first - @seed12 = Wrestler.where(weight_id: @weight.id, original_seed: 12).first - @seed13 = Wrestler.where(weight_id: @weight.id, original_seed: 13).first - @seed14 = Wrestler.where(weight_id: @weight.id, original_seed: 14).first - @seed15 = Wrestler.where(weight_id: @weight.id, original_seed: 15).first - @seed16 = Wrestler.where(weight_id: @weight.id, original_seed: 16).first + @poolOneWrestlers = Wrestler.where(weight_id: @weight.id, poolNumber: 1) + @poolTwoWrestlers = Wrestler.where(weight_id: @weight.id, poolNumber: 2) + @poolThreeWrestlers = Wrestler.where(weight_id: @weight.id, poolNumber: 3) + @poolFourWrestlers = Wrestler.where(weight_id: @weight.id, poolNumber: 4) end diff --git a/app/models/wrestler.rb b/app/models/wrestler.rb index 4613daf..28fac50 100644 --- a/app/models/wrestler.rb +++ b/app/models/wrestler.rb @@ -1,7 +1,7 @@ class Wrestler < ActiveRecord::Base belongs_to :school belongs_to :weight - attr_accessor :matches_all, :isWrestlingThisRound + attr_accessor :matches_all, :isWrestlingThisRound, :boutByRound def isWrestlingThisRound(matchRound) @gMatches = Match.where(g_id: self.id, round: matchRound) @@ -10,11 +10,19 @@ class Wrestler < ActiveRecord::Base if @gMatches.blank? and @rMatches.blank? return false else - puts "He does wrestle this round" return true end end + def boutByRound(round) + @match = matches_all.select{|m| m.round == round}.first + if @match.blank? + return "BYE" + else + return @match.boutNumber + end + end + def matches_all @gMatches = Match.where(g_id: self.id) @rMatches = Match.where(r_id: self.id) diff --git a/app/views/static_pages/_fourPool.html.erb b/app/views/static_pages/_fourPool.html.erb new file mode 100644 index 0000000..91d51fb --- /dev/null +++ b/app/views/static_pages/_fourPool.html.erb @@ -0,0 +1,90 @@ +
| Name | +R1 | +R2 | +R3 | +
|---|---|---|---|
| <%= w.name %> <%= w.season_win %>-<%= w.season_loss %> <%= w.school.name %> | +<%= w.boutByRound(1) %> Result |
+ <%= w.boutByRound(2) %> | +<%= w.boutByRound(3) %> | +
| Name | +R1 | +R2 | +R3 | +
|---|---|---|---|
| <%= w.name %> <%= w.season_win %>-<%= w.season_loss %> <%= w.school.name %> | +<%= w.boutByRound(1) %> Result |
+ <%= w.boutByRound(2) %> | +<%= w.boutByRound(3) %> | +
| Name | +R1 | +R2 | +R3 | +
|---|---|---|---|
| <%= w.name %> <%= w.season_win %>-<%= w.season_loss %> <%= w.school.name %> | +<%= w.boutByRound(1) %> Result |
+ <%= w.boutByRound(2) %> | +<%= w.boutByRound(3) %> | +
| Name | +R1 | +R2 | +R3 | +
|---|---|---|---|
| <%= w.name %> <%= w.season_win %>-<%= w.season_loss %> <%= w.school.name %> | +<%= w.boutByRound(1) %> Result |
+ <%= w.boutByRound(2) %> | +<%= w.boutByRound(3) %> | +
| Name | -R1 | -R2 | -R3 | -R4 | -R5 | -
|---|---|---|---|---|---|
| 1. <%= @seed1.name %> <%= @seed1.season_win %>-<%= @seed1.season_loss %> <%= @seed1.school.name %> | -V2 Result |
- V3 | -V5 | -V4 | -BYE | -
| 2. <%= @seed5.name %> <%= @seed5.season_win %>-<%= @seed5.season_loss %> <%= @seed5.school.name %> | -V1 | -V5 | -V4 | -BYE | -V3 | -
| 3. <%= @seed3.name %> <%= @seed3.season_win %>-<%= @seed3.season_loss %> <%= @seed3.school.name %> | -V4 | -V1 | -BYE | -V5 | -V2 | -
| 4. <%= @seed4.name %> <%= @seed4.season_win %>-<%= @seed4.season_loss %> <%= @seed4.school.name %> | -V3 | -BYE | -V2 | -V1 | -V5 | -
| 5. <%= @seed2.name %> <%= @seed2.season_win %>-<%= @seed2.season_loss %> <%= @seed2.school.name %> | -BYE | -V2 | -V1 | -V3 | -V4 | -