mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-26 07:56:57 +00:00
Created 4 pool view without bracket.
This commit is contained in:
@@ -25,24 +25,10 @@ class StaticPagesController < ApplicationController
|
|||||||
if params[:weight]
|
if params[:weight]
|
||||||
@weight = Weight.find(params[:weight])
|
@weight = Weight.find(params[:weight])
|
||||||
@tournament = Tournament.find(@weight.tournament_id)
|
@tournament = Tournament.find(@weight.tournament_id)
|
||||||
@wrestlers = Wrestler.where(weight_id: @weight.id)
|
@poolOneWrestlers = Wrestler.where(weight_id: @weight.id, poolNumber: 1)
|
||||||
@bracket_size = Wrestler.where(weight_id: @weight.id).count
|
@poolTwoWrestlers = Wrestler.where(weight_id: @weight.id, poolNumber: 2)
|
||||||
@seed1 = Wrestler.where(weight_id: @weight.id, original_seed: 1).first
|
@poolThreeWrestlers = Wrestler.where(weight_id: @weight.id, poolNumber: 3)
|
||||||
@seed10 = Wrestler.where(weight_id: @weight.id, original_seed: 10).first
|
@poolFourWrestlers = Wrestler.where(weight_id: @weight.id, poolNumber: 4)
|
||||||
@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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class Wrestler < ActiveRecord::Base
|
class Wrestler < ActiveRecord::Base
|
||||||
belongs_to :school
|
belongs_to :school
|
||||||
belongs_to :weight
|
belongs_to :weight
|
||||||
attr_accessor :matches_all, :isWrestlingThisRound
|
attr_accessor :matches_all, :isWrestlingThisRound, :boutByRound
|
||||||
|
|
||||||
def isWrestlingThisRound(matchRound)
|
def isWrestlingThisRound(matchRound)
|
||||||
@gMatches = Match.where(g_id: self.id, round: matchRound)
|
@gMatches = Match.where(g_id: self.id, round: matchRound)
|
||||||
@@ -10,11 +10,19 @@ class Wrestler < ActiveRecord::Base
|
|||||||
if @gMatches.blank? and @rMatches.blank?
|
if @gMatches.blank? and @rMatches.blank?
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
puts "He does wrestle this round"
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
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
|
def matches_all
|
||||||
@gMatches = Match.where(g_id: self.id)
|
@gMatches = Match.where(g_id: self.id)
|
||||||
@rMatches = Match.where(r_id: self.id)
|
@rMatches = Match.where(r_id: self.id)
|
||||||
|
|||||||
90
app/views/static_pages/_fourPool.html.erb
Normal file
90
app/views/static_pages/_fourPool.html.erb
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<h5>Pool 1</h5>
|
||||||
|
<table class="table table-striped table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>R1</th>
|
||||||
|
<th>R2</th>
|
||||||
|
<th>R3</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @poolOneWrestlers.each do |w| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= w.name %> <%= w.season_win %>-<%= w.season_loss %> <%= w.school.name %></td>
|
||||||
|
<td><%= w.boutByRound(1) %><br>Result</td>
|
||||||
|
<td><%= w.boutByRound(2) %></td>
|
||||||
|
<td><%= w.boutByRound(3) %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<h5>Pool 2</h5>
|
||||||
|
<table class="table table-striped table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>R1</th>
|
||||||
|
<th>R2</th>
|
||||||
|
<th>R3</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @poolTwoWrestlers.each do |w| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= w.name %> <%= w.season_win %>-<%= w.season_loss %> <%= w.school.name %></td>
|
||||||
|
<td><%= w.boutByRound(1) %><br>Result</td>
|
||||||
|
<td><%= w.boutByRound(2) %></td>
|
||||||
|
<td><%= w.boutByRound(3) %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<h5>Pool 3</h5>
|
||||||
|
<table class="table table-striped table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>R1</th>
|
||||||
|
<th>R2</th>
|
||||||
|
<th>R3</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @poolThreeWrestlers.each do |w| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= w.name %> <%= w.season_win %>-<%= w.season_loss %> <%= w.school.name %></td>
|
||||||
|
<td><%= w.boutByRound(1) %><br>Result</td>
|
||||||
|
<td><%= w.boutByRound(2) %></td>
|
||||||
|
<td><%= w.boutByRound(3) %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<h5>Pool 4</h5>
|
||||||
|
<table class="table table-striped table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>R1</th>
|
||||||
|
<th>R2</th>
|
||||||
|
<th>R3</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @poolFourWrestlers.each do |w| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= w.name %> <%= w.season_win %>-<%= w.season_loss %> <%= w.school.name %></td>
|
||||||
|
<td><%= w.boutByRound(1) %><br>Result</td>
|
||||||
|
<td><%= w.boutByRound(2) %></td>
|
||||||
|
<td><%= w.boutByRound(3) %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
|
|
||||||
<h3>Pool 1</h3>
|
|
||||||
<table class="table table-striped table-bordered">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>R1</th>
|
|
||||||
<th>R2</th>
|
|
||||||
<th>R3</th>
|
|
||||||
<th>R4</th>
|
|
||||||
<th>R5</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>1. <%= @seed1.name %> <%= @seed1.season_win %>-<%= @seed1.season_loss %> <%= @seed1.school.name %></td>
|
|
||||||
<td>V2<br>Result</td>
|
|
||||||
<td>V3</td>
|
|
||||||
<td>V5</td>
|
|
||||||
<td>V4</td>
|
|
||||||
<td>BYE</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>2. <%= @seed5.name %> <%= @seed5.season_win %>-<%= @seed5.season_loss %> <%= @seed5.school.name %></td>
|
|
||||||
<td>V1</td>
|
|
||||||
<td>V5</td>
|
|
||||||
<td>V4</td>
|
|
||||||
<td>BYE</td>
|
|
||||||
<td>V3</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>3. <%= @seed3.name %> <%= @seed3.season_win %>-<%= @seed3.season_loss %> <%= @seed3.school.name %></td>
|
|
||||||
<td>V4</td>
|
|
||||||
<td>V1</td>
|
|
||||||
<td>BYE</td>
|
|
||||||
<td>V5</td>
|
|
||||||
<td>V2</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>4. <%= @seed4.name %> <%= @seed4.season_win %>-<%= @seed4.season_loss %> <%= @seed4.school.name %></td>
|
|
||||||
<td>V3</td>
|
|
||||||
<td>BYE</td>
|
|
||||||
<td>V2</td>
|
|
||||||
<td>V1</td>
|
|
||||||
<td>V5</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>5. <%= @seed2.name %> <%= @seed2.season_win %>-<%= @seed2.season_loss %> <%= @seed2.school.name %></td>
|
|
||||||
<td>BYE</td>
|
|
||||||
<td>V2</td>
|
|
||||||
<td>V1</td>
|
|
||||||
<td>V3</td>
|
|
||||||
<td>V4</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
@@ -2,34 +2,10 @@
|
|||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<h1><%= @weight.max %> lbs Bracket</h1>
|
<h1><%= @weight.max %> lbs Bracket</h1>
|
||||||
<% if @bracket_size == 10 %>
|
<% if @weight.pools == 4 %>
|
||||||
<%= render 'man10' %>
|
<%= render 'fourPool' %>
|
||||||
<% elsif @bracket_size == 9 %>
|
<% elsif @weight.pools == 2 %>
|
||||||
<%= render 'man9' %>
|
<%= render 'twoPool' %>
|
||||||
<% elsif @bracket_size == 8 %>
|
<% elsif @weight.pools == 1 %>
|
||||||
<%= render 'man8' %>
|
<%= render 'onePool' %>
|
||||||
<% elsif @bracket_size == 7 %>
|
|
||||||
<%= render 'man7' %>
|
|
||||||
<% elsif @bracket_size == 6 %>
|
|
||||||
<%= render 'man6' %>
|
|
||||||
<% elsif @bracket_size == 5 %>
|
|
||||||
<%= render 'man5' %>
|
|
||||||
<% elsif @bracket_size == 4 %>
|
|
||||||
<%= render 'man4' %>
|
|
||||||
<% elsif @bracket_size == 3 %>
|
|
||||||
<%= render 'man3' %>
|
|
||||||
<% elsif @bracket_size == 2 %>
|
|
||||||
<%= render 'man2' %>
|
|
||||||
<% elsif @bracket_size == 16 %>
|
|
||||||
<%= render 'man16' %>
|
|
||||||
<% elsif @bracket_size == 15 %>
|
|
||||||
<%= render 'man15' %>
|
|
||||||
<% elsif @bracket_size == 14 %>
|
|
||||||
<%= render 'man14' %>
|
|
||||||
<% elsif @bracket_size == 13 %>
|
|
||||||
<%= render 'man13' %>
|
|
||||||
<% elsif @bracket_size == 12 %>
|
|
||||||
<%= render 'man12' %>
|
|
||||||
<% elsif @bracket_size == 11 %>
|
|
||||||
<%= render 'man11' %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
Reference in New Issue
Block a user