mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-02 21:24:25 +00:00
Test 5 match rule for bracket size 5-16
This commit is contained in:
@@ -40,10 +40,6 @@ class StaticPagesController < ApplicationController
|
||||
@tournament = Tournament.find(@weight.tournament_id)
|
||||
@matches = @tournament.upcomingMatches.select{|m| m.weight_id == @weight.id}
|
||||
@wrestlers = Wrestler.where(weight_id: @weight.id)
|
||||
#@poolOneWrestlers = @wrestlers.select{|w| w.generatePoolNumber == 1}
|
||||
#@poolTwoWrestlers = @wrestlers.select{|w| w.generatePoolNumber == 2}
|
||||
#@poolThreeWrestlers = @wrestlers.select{|w| w.generatePoolNumber == 3}
|
||||
#@poolFourWrestlers = @wrestlers.select{|w| w.generatePoolNumber == 4}
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ class Weight < ActiveRecord::Base
|
||||
belongs_to :tournament
|
||||
has_many :wrestlers, dependent: :destroy
|
||||
|
||||
attr_accessor :pools, :bracket_size, :bracket_type, :poolRounds
|
||||
attr_accessor :pools, :bracket_size, :bracket_type, :poolRounds, :totalRounds
|
||||
|
||||
def pools
|
||||
@wrestlers = self.wrestlers
|
||||
@@ -95,7 +95,7 @@ class Weight < ActiveRecord::Base
|
||||
elsif self.wrestlers.size == 11 || self.wrestlers.size == 12
|
||||
return "fourPoolsToQuarter"
|
||||
elsif self.wrestlers.size > 12 && self.wrestlers.size <= 16
|
||||
return "fourPoolsToSemi"
|
||||
return "fourPoolsToSemi"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -117,4 +117,9 @@ class Weight < ActiveRecord::Base
|
||||
return @poolMatches.sort_by{|m| m.round}.last.round
|
||||
end
|
||||
|
||||
def totalRounds(matches)
|
||||
@matchups = matches.select{|m| m.weight_id == self.id}
|
||||
return @matchups.sort_by{|m| m.round}.last.round
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user