diff --git a/app/models/tournament.rb b/app/models/tournament.rb index 67d8e8c..c870870 100644 --- a/app/models/tournament.rb +++ b/app/models/tournament.rb @@ -128,17 +128,19 @@ end end end - def pool_to_bracket_weights_with_too_many_wrestlers - if self.tournament_type == "Pool to bracket" - weightsWithTooManyWrestlers = weights.select{|w| w.wrestlers.size > 24} - if weightsWithTooManyWrestlers.size < 1 - return nil - else - return weightsWithTooManyWrestlers - end - else - nil - end + def pool_to_bracket_number_of_wrestlers + error_string = "" + if self.tournament_type.include? "Pool to bracket" + weights_with_too_many_wrestlers = weights.select{|w| w.wrestlers.size > 24} + weight_with_too_few_wrestlers = weights.select{|w| w.wrestlers.size < 2} + weights_with_too_many_wrestlers.each do |weight| + error_string = error_string + " The weight class #{weight.max} has more than 24 wrestlers." + end + weight_with_too_few_wrestlers.each do |weight| + error_string = error_string + " The weight class #{weight.max} has less than 2 wrestlers." + end + end + return error_string end def modified_sixteen_man_number_of_wrestlers @@ -158,7 +160,7 @@ end def double_elim_number_of_wrestlers error_string = "" - if self.tournament_type == "Double Elimination 1-6" + if self.tournament_type == "Double Elimination 1-6" or self.tournament_type == "Double Elimination 1-8" weights_with_too_many_wrestlers = weights.select{|w| w.wrestlers.size > 16} weight_with_too_few_wrestlers = weights.select{|w| w.wrestlers.size < 4} weights_with_too_many_wrestlers.each do |weight| @@ -174,14 +176,11 @@ end def match_generation_error error_string = "There is a tournament error." modified_sixteen_man_error = modified_sixteen_man_number_of_wrestlers - double_elim_error = double_elim_number_of_wrestlers - if pool_to_bracket_weights_with_too_many_wrestlers != nil - error_string = error_string + " The following weights have too many wrestlers " - pool_to_bracket_weights_with_too_many_wrestlers.each do |w| - error_string = error_string + "#{w.max} " - end - return error_string - elsif modified_sixteen_man_error.length > 0 + double_elim_error = double_elim_number_of_wrestlers + pool_to_bracket_error = pool_to_bracket_number_of_wrestlers + if pool_to_bracket_error.length > 0 + return error_string + pool_to_bracket_error + elsif modified_sixteen_man_error.length > 0 return error_string + modified_sixteen_man_error elsif double_elim_error.length > 0 return error_string + double_elim_error diff --git a/app/models/weight.rb b/app/models/weight.rb index e306e5f..2e9528d 100644 --- a/app/models/weight.rb +++ b/app/models/weight.rb @@ -12,6 +12,7 @@ class Weight < ActiveRecord::Base # tournament model runs the code via method create_pre_defined_weights HS_WEIGHT_CLASSES = "106,113,120,126,132,138,144,150,157,165,175,190,215,285" HS_GIRLS_WEIGHT_CLASSES = "100,105,110,115,120,125,130,135,140,145,155,170,190,235" + MS_WEIGHT_CLASSES = "80,86,92,98,104,110,116,122,128,134,142,150,160,172,205,245" before_destroy do self.tournament.destroy_all_matches diff --git a/app/views/layouts/_tournament-navbar.html.erb b/app/views/layouts/_tournament-navbar.html.erb index 99edca5..5915715 100644 --- a/app/views/layouts/_tournament-navbar.html.erb +++ b/app/views/layouts/_tournament-navbar.html.erb @@ -45,6 +45,7 @@
  • Time Savers
  • <%= link_to "Create Boys High School Weights (106-285)" , "/tournaments/#{@tournament.id}/create_custom_weights?customValue=#{Weight::HS_WEIGHT_CLASSES}",data: { confirm: 'Are you sure? This will delete all current weights.' } %>
  • <%= link_to "Create Girls High School Weights (101-235)" , "/tournaments/#{@tournament.id}/create_custom_weights?customValue=#{Weight::HS_GIRLS_WEIGHT_CLASSES}",data: { confirm: 'Are you sure? This will delete all current weights.' } %>
  • +
  • <%= link_to "Create Boys Middle School Weights (80-245)" , "/tournaments/#{@tournament.id}/create_custom_weights?customValue=#{Weight::MS_WEIGHT_CLASSES}",data: { confirm: 'Are you sure? This will delete all current weights.' } %>
  • Tournament Actions
  • <%= link_to "Calculate Team Scores" , "/tournaments/#{@tournament.id}/calculate_team_scores", :method => :put %>
  • <%= link_to "Generate Brackets" , "/tournaments/#{@tournament.id}/generate_matches", data: { confirm: 'Are you sure? This will delete all current matches.' } %>
  • diff --git a/app/views/static_pages/about.html.erb b/app/views/static_pages/about.html.erb index bd1dc8e..ae3032c 100644 --- a/app/views/static_pages/about.html.erb +++ b/app/views/static_pages/about.html.erb @@ -36,7 +36,7 @@
  • Most wins by tech fall
  • Most wins by major
  • Most points scored in decisions
  • -
  • Quickest pin
  • +
  • Total pin time accumulation
  • Coin flip
  • If three wrestlers are tied, they will be put through this sequence until two wrestlers are left. Once two wrestlers are left, the pool runner up will be decided by head to head.

    @@ -53,8 +53,8 @@

    See placement points below (based on the largest bracket of the tournament)

    Pool Types