1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-30 19:22:21 +00:00

Before I made correctly

This commit is contained in:
2014-12-09 10:14:01 -05:00
parent 1d024e0571
commit f7e06feb99
9 changed files with 130 additions and 42 deletions

View File

@@ -85,12 +85,12 @@ class StaticPagesController < ApplicationController
@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
@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
@bracket_size = Wrestler.where(weight_id: weight.id).count
def createMatch(r_id,g_id,tournament)
@match = Match.new
@@ -109,6 +109,36 @@ class StaticPagesController < ApplicationController
createMatch(@seed10.id,@seed6.id,@tournament.id)
createMatch(@seed4.id,@seed13.id,@tournament.id)
createMatch(@seed9.id,@seed5.id,@tournament.id)
elsif @bracket_size == 15
createMatch(@seed1.id,@seed15.id,@tournament.id)
createMatch(@seed12.id,@seed8.id,@tournament.id)
createMatch(@seed2.id,@seed14.id,@tournament.id)
createMatch(@seed11.id,@seed7.id,@tournament.id)
createMatch(@seed3.id,@seed13.id,@tournament.id)
createMatch(@seed10.id,@seed6.id,@tournament.id)
createMatch(@seed9.id,@seed5.id,@tournament.id)
elsif @bracket_size == 14
createMatch(@seed1.id,@seed14.id,@tournament.id)
createMatch(@seed12.id,@seed8.id,@tournament.id)
createMatch(@seed2.id,@seed13.id,@tournament.id)
createMatch(@seed11.id,@seed7.id,@tournament.id)
createMatch(@seed10.id,@seed6.id,@tournament.id)
createMatch(@seed9.id,@seed5.id,@tournament.id)
elsif @bracket_size == 13
createMatch(@seed1.id,@seed13.id,@tournament.id)
createMatch(@seed12.id,@seed8.id,@tournament.id)
createMatch(@seed11.id,@seed7.id,@tournament.id)
createMatch(@seed10.id,@seed6.id,@tournament.id)
createMatch(@seed9.id,@seed5.id,@tournament.id)
elsif @bracket_size == 12
createMatch(@seed12.id,@seed8.id,@tournament.id)
createMatch(@seed11.id,@seed7.id,@tournament.id)
createMatch(@seed10.id,@seed6.id,@tournament.id)
createMatch(@seed9.id,@seed5.id,@tournament.id)
elsif @bracket_size == 11
createMatch(@seed11.id,@seed8.id,@tournament.id)
createMatch(@seed10.id,@seed7.id,@tournament.id)
createMatch(@seed9.id,@seed6.id,@tournament.id)
elsif @bracket_size == 10
createMatch(@seed1.id,@seed10.id,@tournament.id)
createMatch(@seed5.id,@seed7.id,@tournament.id)
@@ -138,11 +168,12 @@ class StaticPagesController < ApplicationController
@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
@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
@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
@seed11 = Wrestler.where(weight_id: weight.id, original_seed: 11).first
@bracket_size = Wrestler.where(weight_id: weight.id).count
def createMatch(r_id,g_id,tournament)
@match = Match.new
@@ -161,6 +192,36 @@ class StaticPagesController < ApplicationController
createMatch(@seed14.id,@seed6.id,@tournament.id)
createMatch(@seed4.id,@seed9.id,@tournament.id)
createMatch(@seed13.id,@seed5.id,@tournament.id)
elsif @bracket_size == 15
createMatch(@seed1.id,@seed12.id,@tournament.id)
createMatch(@seed15.id,@seed8.id,@tournament.id)
createMatch(@seed2.id,@seed11.id,@tournament.id)
createMatch(@seed14.id,@seed7.id,@tournament.id)
createMatch(@seed3.id,@seed10.id,@tournament.id)
createMatch(@seed13.id,@seed6.id,@tournament.id)
createMatch(@seed4.id,@seed9.id,@tournament.id)
elsif @bracket_size == 14
createMatch(@seed1.id,@seed12.id,@tournament.id)
createMatch(@seed14.id,@seed8.id,@tournament.id)
createMatch(@seed2.id,@seed11.id,@tournament.id)
createMatch(@seed13.id,@seed7.id,@tournament.id)
createMatch(@seed3.id,@seed10.id,@tournament.id)
createMatch(@seed9.id,@seed4.id,@tournament.id)
elsif @bracket_size == 13
createMatch(@seed1.id,@seed12.id,@tournament.id)
createMatch(@seed13.id,@seed8.id,@tournament.id)
createMatch(@seed2.id,@seed11.id,@tournament.id)
createMatch(@seed3.id,@seed10.id,@tournament.id)
createMatch(@seed4.id,@seed9.id,@tournament.id)
elsif @bracket_size == 12
createMatch(@seed1.id,@seed12.id,@tournament.id)
createMatch(@seed2.id,@seed11.id,@tournament.id)
createMatch(@seed3.id,@seed10.id,@tournament.id)
createMatch(@seed4.id,@seed9.id,@tournament.id)
elsif @bracket_size == 11
createMatch(@seed1.id,@seed11.id,@tournament.id)
createMatch(@seed2.id,@seed10.id,@tournament.id)
createMatch(@seed3.id,@seed9.id,@tournament.id)
elsif @bracket_size == 10
createMatch(@seed1.id,@seed5.id,@tournament.id)
createMatch(@seed10.id,@seed4.id,@tournament.id)
@@ -176,6 +237,9 @@ class StaticPagesController < ApplicationController
elsif @bracket_size == 7
createMatch(@seed1.id,@seed5.id,@tournament.id)
createMatch(@seed2.id,@seed6.id,@tournament.id)
elsif @bracket_size == 6
createMatch(@seed1.id,@seed5.id,@tournament.id)
createMatch(@seed2.id,@seed6.id,@tournament.id)
end
end
@@ -191,11 +255,12 @@ class StaticPagesController < ApplicationController
@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
@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
@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
@seed11 = Wrestler.where(weight_id: weight.id, original_seed: 11).first
@bracket_size = Wrestler.where(weight_id: weight.id).count
def createMatch(r_id,g_id,tournament)
@match = Match.new
@@ -214,6 +279,37 @@ class StaticPagesController < ApplicationController
createMatch(@seed10.id,@seed14.id,@tournament.id)
createMatch(@seed4.id,@seed5.id,@tournament.id)
createMatch(@seed9.id,@seed13.id,@tournament.id)
elsif @bracket_size == 15
createMatch(@seed1.id,@seed8.id,@tournament.id)
createMatch(@seed15.id,@seed12.id,@tournament.id)
createMatch(@seed2.id,@seed7.id,@tournament.id)
createMatch(@seed11.id,@seed14.id,@tournament.id)
createMatch(@seed3.id,@seed6.id,@tournament.id)
createMatch(@seed13.id,@seed10.id,@tournament.id)
createMatch(@seed4.id,@seed5.id,@tournament.id)
elsif @bracket_size == 14
createMatch(@seed1.id,@seed8.id,@tournament.id)
createMatch(@seed14.id,@seed12.id,@tournament.id)
createMatch(@seed2.id,@seed7.id,@tournament.id)
createMatch(@seed13.id,@seed11.id,@tournament.id)
createMatch(@seed3.id,@seed6.id,@tournament.id)
createMatch(@seed4.id,@seed5.id,@tournament.id)
elsif @bracket_size == 13
createMatch(@seed1.id,@seed8.id,@tournament.id)
createMatch(@seed13.id,@seed12.id,@tournament.id)
createMatch(@seed2.id,@seed7.id,@tournament.id)
createMatch(@seed3.id,@seed6.id,@tournament.id)
createMatch(@seed4.id,@seed5.id,@tournament.id)
elsif @bracket_size == 12
createMatch(@seed1.id,@seed8.id,@tournament.id)
createMatch(@seed2.id,@seed7.id,@tournament.id)
createMatch(@seed3.id,@seed6.id,@tournament.id)
createMatch(@seed4.id,@seed5.id,@tournament.id)
elsif @bracket_size == 11
createMatch(@seed1.id,@seed8.id,@tournament.id)
createMatch(@seed2.id,@seed7.id,@tournament.id)
createMatch(@seed3.id,@seed6.id,@tournament.id)
createMatch(@seed4.id,@seed5.id,@tournament.id)
elsif @bracket_size == 10
createMatch(@seed1.id,@seed4.id,@tournament.id)
createMatch(@seed10.id,@seed7.id,@tournament.id)
@@ -229,6 +325,9 @@ class StaticPagesController < ApplicationController
elsif @bracket_size == 7
createMatch(@seed1.id,@seed4.id,@tournament.id)
createMatch(@seed2.id,@seed3.id,@tournament.id)
elsif @bracket_size == 6
createMatch(@seed1.id,@seed4.id,@tournament.id)
createMatch(@seed2.id,@seed3.id,@tournament.id)
end
end
@@ -272,6 +371,9 @@ class StaticPagesController < ApplicationController
createMatch(@seed1.id,@seed7.id,@tournament.id)
createMatch(@seed5.id,@seed4.id,@tournament.id)
createMatch(@seed6.id,@seed3.id,@tournament.id)
elsif @bracket_size == 6
createMatch(@seed5.id,@seed4.id,@tournament.id)
createMatch(@seed6.id,@seed3.id,@tournament.id)
end
end

View File

@@ -52,7 +52,7 @@
<tr>
<td>5. <%= @seed2.name %> <%= @seed2.season_win %>-<%= @seed2.season_loss %> <%= School.find(@seed2.school_id).name %></td>
<td>BYE</td>
<td>BYE</td>
<td>V7</td>
<td>V8</td>
</tr>
<tr>
@@ -62,14 +62,14 @@
<td>V7</td>
</tr>
<tr>
<td>7. BYE</td>
<td>7. <%= @seed10.name %> <%= @seed10.season_win %>-<%= @seed10.season_loss %> <%= School.find(@seed10.school_id).name %></td>
<td>V8</td>
<td>V5</td>
<td>BYE</td>
</tr>
<tr>
<td>8. <%= @seed7.name %> <%= @seed7.season_win %>-<%= @seed7.season_loss %> <%= School.find(@seed7.school_id).name %></td>
<td>BYE</td>
<td>V7</td>
<td>BYE</td>
<td>V5</td>
</tr>
@@ -99,7 +99,7 @@
<td>V11</td>
</tr>
<tr>
<td>11. <%= @seed10.name %> <%= @seed10.season_win %>-<%= @seed10.season_loss %> <%= School.find(@seed10.school_id).name %></td>
<td>11. <%= @seed9.name %> <%= @seed9.season_win %>-<%= @seed9.season_loss %> <%= School.find(@seed9.school_id).name %></td>
<td>V12</td>
<td>V9</td>
<td>BYE</td>
@@ -128,24 +128,24 @@
<tr>
<td>13. <%= @seed4.name %> <%= @seed4.season_win %>-<%= @seed4.season_loss %> <%= School.find(@seed4.school_id).name %></td>
<td>BYE</td>
<td>V15</td>
<td>BYE</td>
<td>V16</td>
</tr>
<tr>
<td>14. BYE</td>
<td>V13</td>
<td>V16</td>
<td>V15</td>
<td>BYE</td>
</tr>
<tr>
<td>15. <%= @seed9.name %> <%= @seed9.season_win %>-<%= @seed9.season_loss %> <%= School.find(@seed9.school_id).name %></td>
<td>15. BYE</td>
<td>V16</td>
<td>V13</td>
<td>BYE</td>
</tr>
<tr>
<td>16. <%= @seed5.name %> <%= @seed5.season_win %>-<%= @seed5.season_loss %> <%= School.find(@seed5.school_id).name %></td>
<td>V15</td>
<td>BYE</td>
<td>BYE</td>
<td>V13</td>
</tr>

View File

@@ -75,6 +75,8 @@
</tr>
</tbody>
</table>
<br>
<br>
<h3>Pool 3</h3>
<table class="table table-striped table-bordered">
<thead>

View File

@@ -1,17 +0,0 @@
<h1>School Scores</h1>
<table class="table table-striped table-bordered">
<thead>
<tr>
<td>Name</td>
<td>Score</td>
</tr>
</thead>
<tbody>
<% @school.each do |school| %>
<tr>
<td><%= school.name %></td>
<td><%= school.score %></td>
</tr>
<% end %>
</tbody>
</table>

View File

@@ -28,7 +28,7 @@
<% if user_signed_in? %>
<%= link_to "New #{@tournament.name} School" , "/schools/new?tournament=#{@tournament.id}" %>
<br>
BE CAREFUL <%= link_to "Generate Matches" , "/static_pages/generate_matches?tournament=#{@tournament.id}" %>
BE CAREFUL <%= link_to "Generate Pool Matches" , "/static_pages/generate_matches?tournament=#{@tournament.id}" %>
<% end %>
<br>
<br>

0
bin/bundle Executable file → Normal file
View File

0
bin/rails Executable file → Normal file
View File

0
bin/rake Executable file → Normal file
View File

View File

@@ -5,3 +5,4 @@
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
User.create(email: 'test@test.com', password: 'password', password_confirmation: 'password')