From f7e06feb996ffdaecc07ccd85fb8bea527252588 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Tue, 9 Dec 2014 10:14:01 -0500 Subject: [PATCH] Before I made correctly --- app/controllers/static_pages_controller.rb | 134 ++++++++++++++++++--- app/views/static_pages/_man11.html.erb | 16 +-- app/views/static_pages/_man15.html.erb | 2 + app/views/static_pages/school.html.erb | 17 --- app/views/tournaments/show.html.erb | 2 +- bin/bundle | 0 bin/rails | 0 bin/rake | 0 db/seeds.rb | 1 + 9 files changed, 130 insertions(+), 42 deletions(-) delete mode 100644 app/views/static_pages/school.html.erb mode change 100755 => 100644 bin/bundle mode change 100755 => 100644 bin/rails mode change 100755 => 100644 bin/rake diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb index 70315dc..1a20c50 100644 --- a/app/controllers/static_pages_controller.rb +++ b/app/controllers/static_pages_controller.rb @@ -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 diff --git a/app/views/static_pages/_man11.html.erb b/app/views/static_pages/_man11.html.erb index 8ec8beb..85f632d 100644 --- a/app/views/static_pages/_man11.html.erb +++ b/app/views/static_pages/_man11.html.erb @@ -52,7 +52,7 @@ 5. <%= @seed2.name %> <%= @seed2.season_win %>-<%= @seed2.season_loss %> <%= School.find(@seed2.school_id).name %> BYE - BYE + V7 V8 @@ -62,14 +62,14 @@ V7 - 7. BYE + 7. <%= @seed10.name %> <%= @seed10.season_win %>-<%= @seed10.season_loss %> <%= School.find(@seed10.school_id).name %> V8 V5 BYE 8. <%= @seed7.name %> <%= @seed7.season_win %>-<%= @seed7.season_loss %> <%= School.find(@seed7.school_id).name %> - BYE + V7 BYE V5 @@ -99,7 +99,7 @@ V11 - 11. <%= @seed10.name %> <%= @seed10.season_win %>-<%= @seed10.season_loss %> <%= School.find(@seed10.school_id).name %> + 11. <%= @seed9.name %> <%= @seed9.season_win %>-<%= @seed9.season_loss %> <%= School.find(@seed9.school_id).name %> V12 V9 BYE @@ -128,24 +128,24 @@ 13. <%= @seed4.name %> <%= @seed4.season_win %>-<%= @seed4.season_loss %> <%= School.find(@seed4.school_id).name %> BYE - V15 + BYE V16 14. BYE V13 V16 - V15 + BYE - 15. <%= @seed9.name %> <%= @seed9.season_win %>-<%= @seed9.season_loss %> <%= School.find(@seed9.school_id).name %> + 15. BYE V16 V13 BYE 16. <%= @seed5.name %> <%= @seed5.season_win %>-<%= @seed5.season_loss %> <%= School.find(@seed5.school_id).name %> - V15 + BYE BYE V13 diff --git a/app/views/static_pages/_man15.html.erb b/app/views/static_pages/_man15.html.erb index 04e3e94..32c69a2 100644 --- a/app/views/static_pages/_man15.html.erb +++ b/app/views/static_pages/_man15.html.erb @@ -75,6 +75,8 @@ +
+

Pool 3

diff --git a/app/views/static_pages/school.html.erb b/app/views/static_pages/school.html.erb deleted file mode 100644 index 45f7937..0000000 --- a/app/views/static_pages/school.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -

School Scores

-
- - - - - - - - <% @school.each do |school| %> - - - - - <% end %> - -
NameScore
<%= school.name %><%= school.score %>
\ No newline at end of file diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb index d1ab010..69566be 100644 --- a/app/views/tournaments/show.html.erb +++ b/app/views/tournaments/show.html.erb @@ -28,7 +28,7 @@ <% if user_signed_in? %> <%= link_to "New #{@tournament.name} School" , "/schools/new?tournament=#{@tournament.id}" %>
- 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 %>

diff --git a/bin/bundle b/bin/bundle old mode 100755 new mode 100644 diff --git a/bin/rails b/bin/rails old mode 100755 new mode 100644 diff --git a/bin/rake b/bin/rake old mode 100755 new mode 100644 diff --git a/db/seeds.rb b/db/seeds.rb index 4edb1e8..4bbe86e 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -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') \ No newline at end of file