mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Added 16 man modified double elimination bracket type. Still need to fix swap wrestlers code.
This commit is contained in:
@@ -14,6 +14,7 @@ class AdvanceWrestler
|
||||
|
||||
def advance_raw
|
||||
pool_to_bracket_advancement if @tournament.tournament_type == "Pool to bracket"
|
||||
DoubleEliminationAdvance.new(@wrestler).bracket_advancement if @tournament.tournament_type == "Modified 16 Man Double Elimination"
|
||||
end
|
||||
|
||||
def pool_to_bracket_advancement
|
||||
|
||||
107
app/services/bracket_advancement/double_elimination_advance.rb
Normal file
107
app/services/bracket_advancement/double_elimination_advance.rb
Normal file
@@ -0,0 +1,107 @@
|
||||
class DoubleEliminationAdvance
|
||||
|
||||
def initialize(wrestler)
|
||||
@wrestler = wrestler
|
||||
@last_match = @wrestler.last_match
|
||||
end
|
||||
|
||||
def bracket_advancement
|
||||
if @last_match.winner_id == @wrestler.id
|
||||
winner_advance
|
||||
end
|
||||
if @last_match.winner_id != @wrestler.id
|
||||
loser_advance
|
||||
end
|
||||
end
|
||||
|
||||
def winner_advance
|
||||
if (@last_match.loser1_name == "BYE" or @last_match.loser2_name == "BYE") and @last_match.is_championship_match
|
||||
update_consolation_bye
|
||||
end
|
||||
if @wrestler.last_match.bracket_position == "Quarter"
|
||||
new_match = Match.where("bracket_position = ? AND bracket_position_number = ? AND weight_id = ?","Semis",@wrestler.next_match_position_number.ceil,@wrestler.weight_id).first
|
||||
update_new_match(new_match, get_wrestler_number)
|
||||
elsif @wrestler.last_match.bracket_position == "Semis"
|
||||
new_match = Match.where("bracket_position = ? AND bracket_position_number = ? AND weight_id = ?","1/2",@wrestler.next_match_position_number.ceil,@wrestler.weight_id).first
|
||||
update_new_match(new_match, get_wrestler_number)
|
||||
elsif @wrestler.last_match.bracket_position == "Conso Semis"
|
||||
# if its a regular double elim
|
||||
if Match.where("bracket_position = ? AND bracket_position_number = ? AND weight_id = ?","Conso Semis",@wrestler.next_match_position_number.ceil,@wrestler.weight_id).first.loser1_name != nil
|
||||
new_match = Match.where("bracket_position = ? AND bracket_position_number = ? AND weight_id = ?","3/4",@wrestler.next_match_position_number.ceil,@wrestler.weight_id).first
|
||||
update_new_match(new_match, get_wrestler_number)
|
||||
# if it's a special bracket where consolations wrestler for 5th
|
||||
else
|
||||
new_match = Match.where("bracket_position = ? AND bracket_position_number = ? AND weight_id = ?","5/6",@wrestler.next_match_position_number.ceil,@wrestler.weight_id).first
|
||||
update_new_match(new_match, get_wrestler_number)
|
||||
end
|
||||
elsif @wrestler.last_match.bracket_position == "Conso Quarter"
|
||||
next_round_matches = Match.where("weight_id = ? and bracket_position = ?", @wrestler.weight_id, "Conso Semis").sort_by{|m| m.round}
|
||||
this_round_matches = Match.where("weight_id = ? and round = ? and bracket_position = ?", @wrestler.weight_id, @wrestler.last_match.round, "Conso Quarter")
|
||||
if next_round_matches.size == this_round_matches.size
|
||||
# if a semi loser is dropping down
|
||||
new_match = Match.where("bracket_position = ? AND bracket_position_number = ? AND weight_id = ?","Conso Semis",@wrestler.last_match.bracket_position_number,@wrestler.weight_id).first
|
||||
update_new_match(new_match,2)
|
||||
else
|
||||
# if it's a special bracket where a semi loser is not dropping down
|
||||
new_match = Match.where("bracket_position = ? AND bracket_position_number = ? AND weight_id = ?","Conso Semis",@wrestler.next_match_position_number.ceil,@wrestler.weight_id).first
|
||||
update_new_match(new_match, get_wrestler_number)
|
||||
end
|
||||
elsif @wrestler.last_match.bracket_position == "Bracket"
|
||||
new_match = Match.where("bracket_position_number = ? and weight_id = ? and round > ? and (bracket_position = ? or bracket_position = ?)", @wrestler.next_match_position_number.ceil,@wrestler.weight_id, @wrestler.last_match.round , "Bracket", "Quarter").sort_by{|m| m.round}.first
|
||||
update_new_match(new_match, get_wrestler_number)
|
||||
elsif @wrestler.last_match.bracket_position == "Conso"
|
||||
next_round_matches = Match.where("weight_id = ? and round > ? and (bracket_position = ? or bracket_position = ?)", @wrestler.weight_id, @wrestler.last_match.round, "Conso", "Conso Quarter").sort_by{|m| m.round}
|
||||
this_round_matches = Match.where("weight_id = ? and round = ? and (bracket_position = ? or bracket_position = ?)", @wrestler.weight_id, @wrestler.last_match.round, "Conso", "Conso Quarter")
|
||||
# if a loser is dropping down
|
||||
if next_round_matches.size == this_round_matches.size
|
||||
new_match = Match.where("bracket_position_number = ? and weight_id = ? and round > ? and (bracket_position = ? or bracket_position = ?)", @wrestler.last_match.bracket_position_number,@wrestler.weight_id, @wrestler.last_match.round, "Conso", "Conso Quarter").sort_by{|m| m.round}.first
|
||||
update_new_match(new_match, 2)
|
||||
else
|
||||
new_match = Match.where("bracket_position_number = ? and weight_id = ? and round > ? and (bracket_position = ? or bracket_position = ?)", @wrestler.next_match_position_number.ceil,@wrestler.weight_id, @wrestler.last_match.round, "Conso", "Conso Quarter").sort_by{|m| m.round}.first
|
||||
update_new_match(new_match, get_wrestler_number)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update_new_match(match, wrestler_number)
|
||||
if wrestler_number == 2 or match.loser1_name != nil
|
||||
match.w2 = @wrestler.id
|
||||
match.save
|
||||
elsif
|
||||
match.w1 = @wrestler.id
|
||||
match.save
|
||||
end
|
||||
end
|
||||
|
||||
def update_consolation_bye
|
||||
bout = @wrestler.last_match.bout_number
|
||||
next_match = Match.where("(loser1_name = ? OR loser2_name = ?) AND weight_id = ?","Loser of #{bout}","Loser of #{bout}",@wrestler.weight_id)
|
||||
if next_match.size > 0
|
||||
next_match.first.replace_loser_name_with_bye("Loser of #{bout}")
|
||||
end
|
||||
end
|
||||
|
||||
def get_wrestler_number
|
||||
if @wrestler.next_match_position_number != @wrestler.next_match_position_number.ceil
|
||||
return 1
|
||||
elsif @wrestler.next_match_position_number == @wrestler.next_match_position_number.ceil
|
||||
return 2
|
||||
end
|
||||
end
|
||||
|
||||
def loser_advance
|
||||
bout = @wrestler.last_match.bout_number
|
||||
next_match = Match.where("(loser1_name = ? OR loser2_name = ?) AND weight_id = ?","Loser of #{bout}","Loser of #{bout}",@wrestler.weight_id)
|
||||
if next_match.size > 0
|
||||
next_match = next_match.first
|
||||
next_match.replace_loser_name_with_wrestler(@wrestler,"Loser of #{bout}")
|
||||
if next_match.loser1_name == "BYE" or next_match.loser2_name == "BYE"
|
||||
next_match.winner_id = @wrestler.id
|
||||
next_match.win_type = "BYE"
|
||||
next_match.finished = 1
|
||||
next_match.save
|
||||
next_match.advance_wrestlers
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -33,8 +33,10 @@ class GenerateTournamentMatches
|
||||
def generate_raw
|
||||
standardStartingActions
|
||||
PoolToBracketMatchGeneration.new(@tournament).generatePoolToBracketMatches if @tournament.tournament_type == "Pool to bracket"
|
||||
ModifiedSixteenManMatchGeneration.new(@tournament).generate_matches if @tournament.tournament_type == "Modified 16 Man Double Elimination"
|
||||
postMatchCreationActions
|
||||
PoolToBracketMatchGeneration.new(@tournament).assignLoserNames if @tournament.tournament_type == "Pool to bracket"
|
||||
ModifiedSixteenManGenerateLoserNames.new(@tournament).assign_loser_names if @tournament.tournament_type == "Modified 16 Man Double Elimination"
|
||||
end
|
||||
|
||||
def standardStartingActions
|
||||
@@ -45,7 +47,7 @@ class GenerateTournamentMatches
|
||||
end
|
||||
|
||||
def postMatchCreationActions
|
||||
moveFinalsMatchesToLastRound
|
||||
moveFinalsMatchesToLastRound if @tournament.tournament_type == "Pool to bracket"
|
||||
assignBouts
|
||||
assignFirstMatchesToMats
|
||||
@tournament.curently_generating_matches = nil
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
class ModifiedSixteenManGenerateLoserNames
|
||||
def initialize( tournament )
|
||||
@tournament = tournament
|
||||
end
|
||||
|
||||
def assign_loser_names
|
||||
matches_by_weight = nil
|
||||
@tournament.weights.each do |w|
|
||||
matches_by_weight = @tournament.matches.where(weight_id: w.id)
|
||||
conso_round_2(matches_by_weight)
|
||||
conso_round_3(matches_by_weight)
|
||||
third_fourth(matches_by_weight)
|
||||
save_matches(matches_by_weight)
|
||||
matches_by_weight = @tournament.matches.where(weight_id: w.id).reload
|
||||
advance_bye_matches_championship(matches_by_weight)
|
||||
save_matches(matches_by_weight)
|
||||
end
|
||||
end
|
||||
|
||||
def conso_round_2(matches)
|
||||
matches.select{|m| m.round == 2 and m.bracket_position == "Conso"}.sort_by{|m| m.bracket_position_number}.each do |match|
|
||||
if match.bracket_position_number == 1
|
||||
match.loser1_name = "Loser of #{matches.select{|m| m.bracket_position_number == 1 and m.round == 1 and m.bracket_position == "Bracket"}.first.bout_number}"
|
||||
match.loser2_name = "Loser of #{matches.select{|m| m.bracket_position_number == 2 and m.round == 1 and m.bracket_position == "Bracket"}.first.bout_number}"
|
||||
elsif match.bracket_position_number == 2
|
||||
match.loser1_name = "Loser of #{matches.select{|m| m.bracket_position_number == 3 and m.round == 1 and m.bracket_position == "Bracket"}.first.bout_number}"
|
||||
match.loser2_name = "Loser of #{matches.select{|m| m.bracket_position_number == 4 and m.round == 1 and m.bracket_position == "Bracket"}.first.bout_number}"
|
||||
elsif match.bracket_position_number == 3
|
||||
match.loser1_name = "Loser of #{matches.select{|m| m.bracket_position_number == 5 and m.round == 1 and m.bracket_position == "Bracket"}.first.bout_number}"
|
||||
match.loser2_name = "Loser of #{matches.select{|m| m.bracket_position_number == 6 and m.round == 1 and m.bracket_position == "Bracket"}.first.bout_number}"
|
||||
elsif match.bracket_position_number == 4
|
||||
match.loser1_name = "Loser of #{matches.select{|m| m.bracket_position_number == 7 and m.round == 1 and m.bracket_position == "Bracket"}.first.bout_number}"
|
||||
match.loser2_name = "Loser of #{matches.select{|m| m.bracket_position_number == 8 and m.round == 1 and m.bracket_position == "Bracket"}.first.bout_number}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def conso_round_3(matches)
|
||||
matches.select{|m| m.round == 3 and m.bracket_position == "Conso Quarter"}.sort_by{|m| m.bracket_position_number}.each do |match|
|
||||
if match.bracket_position_number == 1
|
||||
match.loser1_name = "Loser of #{matches.select{|m| m.bracket_position_number == 4 and m.bracket_position == "Quarter"}.first.bout_number}"
|
||||
elsif match.bracket_position_number == 2
|
||||
match.loser1_name = "Loser of #{matches.select{|m| m.bracket_position_number == 3 and m.bracket_position == "Quarter"}.first.bout_number}"
|
||||
elsif match.bracket_position_number == 3
|
||||
match.loser1_name = "Loser of #{matches.select{|m| m.bracket_position_number == 2 and m.bracket_position == "Quarter"}.first.bout_number}"
|
||||
elsif match.bracket_position_number == 4
|
||||
match.loser1_name = "Loser of #{matches.select{|m| m.bracket_position_number == 1 and m.bracket_position == "Quarter"}.first.bout_number}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def third_fourth(matches)
|
||||
matches.select{|m| m.bracket_position == "3/4"}.sort_by{|m| m.bracket_position_number}.each do |match|
|
||||
match.loser1_name = "Loser of #{matches.select{|m| m.bracket_position == "Semis"}.first.bout_number}"
|
||||
match.loser2_name = "Loser of #{matches.select{|m| m.bracket_position == "Semis"}.second.bout_number}"
|
||||
end
|
||||
end
|
||||
|
||||
def advance_bye_matches_championship(matches)
|
||||
matches.select{|m| m.round == 1 and m.bracket_position == "Bracket"}.sort_by{|m| m.bracket_position_number}.each do |match|
|
||||
if match.w1 == nil or match.w2 == nil
|
||||
puts match.bout_number
|
||||
match.finished = 1
|
||||
match.win_type = "BYE"
|
||||
if match.w1 != nil
|
||||
match.winner_id = match.w1
|
||||
match.loser2_name = "BYE"
|
||||
match.save
|
||||
match.advance_wrestlers
|
||||
elsif match.w2 != nil
|
||||
match.winner_id = match.w2
|
||||
match.loser1_name = "BYE"
|
||||
match.save
|
||||
match.advance_wrestlers
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def save_matches(matches)
|
||||
matches.each do |m|
|
||||
m.save!
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,87 @@
|
||||
class ModifiedSixteenManMatchGeneration
|
||||
def initialize( tournament )
|
||||
@tournament = tournament
|
||||
end
|
||||
|
||||
def generate_matches
|
||||
@tournament.weights.each do |weight|
|
||||
generate_matches_for_weight(weight)
|
||||
end
|
||||
end
|
||||
|
||||
def generate_matches_for_weight(weight)
|
||||
round_one(weight)
|
||||
round_two(weight)
|
||||
round_three(weight)
|
||||
round_four(weight)
|
||||
round_five(weight)
|
||||
end
|
||||
|
||||
def round_one(weight)
|
||||
create_matchup_from_seed(1,16, "Bracket", 1, 1,weight)
|
||||
create_matchup_from_seed(8,9, "Bracket", 2, 1,weight)
|
||||
create_matchup_from_seed(5,12, "Bracket", 3, 1,weight)
|
||||
create_matchup_from_seed(4,14, "Bracket", 4, 1,weight)
|
||||
create_matchup_from_seed(3,13, "Bracket", 5, 1,weight)
|
||||
create_matchup_from_seed(6,11, "Bracket", 6, 1,weight)
|
||||
create_matchup_from_seed(7,10, "Bracket", 7, 1,weight)
|
||||
create_matchup_from_seed(2,15, "Bracket", 8, 1,weight)
|
||||
end
|
||||
|
||||
def round_two(weight)
|
||||
create_matchup(nil,nil,"Quarter",1,2,weight)
|
||||
create_matchup(nil,nil,"Quarter",2,2,weight)
|
||||
create_matchup(nil,nil,"Quarter",3,2,weight)
|
||||
create_matchup(nil,nil,"Quarter",4,2,weight)
|
||||
create_matchup(nil,nil,"Conso",1,2,weight)
|
||||
create_matchup(nil,nil,"Conso",2,2,weight)
|
||||
create_matchup(nil,nil,"Conso",3,2,weight)
|
||||
create_matchup(nil,nil,"Conso",4,2,weight)
|
||||
end
|
||||
|
||||
def round_three(weight)
|
||||
create_matchup(nil,nil,"Semis",1,3,weight)
|
||||
create_matchup(nil,nil,"Semis",2,3,weight)
|
||||
create_matchup(nil,nil,"Conso Quarter",1,3,weight)
|
||||
create_matchup(nil,nil,"Conso Quarter",2,3,weight)
|
||||
create_matchup(nil,nil,"Conso Quarter",3,3,weight)
|
||||
create_matchup(nil,nil,"Conso Quarter",4,3,weight)
|
||||
end
|
||||
|
||||
def round_four(weight)
|
||||
create_matchup(nil,nil,"Conso Semis",1,4,weight)
|
||||
create_matchup(nil,nil,"Conso Semis",2,4,weight)
|
||||
end
|
||||
|
||||
def round_five(weight)
|
||||
create_matchup(nil,nil,"1/2",1,5,weight)
|
||||
create_matchup(nil,nil,"3/4",1,5,weight)
|
||||
create_matchup(nil,nil,"5/6",1,5,weight)
|
||||
end
|
||||
|
||||
def wrestler_with_seed(seed,weight)
|
||||
wrestler = Wrestler.where("weight_id = ? and bracket_line = ?", weight.id, seed).first
|
||||
if wrestler
|
||||
return wrestler.id
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
def create_matchup_from_seed(w1_seed, w2_seed, bracket_position, bracket_position_number,round,weight)
|
||||
# if wrestler_with_seed(w1_seed,weight) and wrestler_with_seed(w2_seed,weight)
|
||||
create_matchup(wrestler_with_seed(w1_seed,weight),wrestler_with_seed(w2_seed,weight), bracket_position, bracket_position_number,round,weight)
|
||||
# end
|
||||
end
|
||||
|
||||
def create_matchup(w1, w2, bracket_position, bracket_position_number,round,weight)
|
||||
@tournament.matches.create(
|
||||
w1: w1,
|
||||
w2: w2,
|
||||
weight_id: weight.id,
|
||||
round: round,
|
||||
bracket_position: bracket_position,
|
||||
bracket_position_number: bracket_position_number
|
||||
)
|
||||
end
|
||||
end
|
||||
@@ -25,7 +25,9 @@ class CalculateWrestlerTeamScore
|
||||
end
|
||||
|
||||
def placement_points
|
||||
PoolBracketPlacementPoints.new(@wrestler).calcPoints if @tournament.tournament_type == "Pool to bracket"
|
||||
return PoolBracketPlacementPoints.new(@wrestler).calcPoints if @tournament.tournament_type == "Pool to bracket"
|
||||
return ModifiedSixteenManPlacementPoints.new(@wrestler).calc_points if @tournament.tournament_type == "Modified 16 Man Double Elimination"
|
||||
return 0
|
||||
end
|
||||
|
||||
def bracketPoints
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
class ModifiedSixteenManPlacementPoints
|
||||
def initialize(wrestler)
|
||||
@wrestler = wrestler
|
||||
@number_of_placers = 6
|
||||
end
|
||||
|
||||
def calc_points
|
||||
if won_bracket_position_size("1/2") > 0
|
||||
return PlacementPoints.new(@number_of_placers).firstPlace
|
||||
elsif bracket_position_size("1/2") > 0
|
||||
return PlacementPoints.new(@number_of_placers).secondPlace
|
||||
elsif won_bracket_position_size("3/4") > 0
|
||||
return PlacementPoints.new(@number_of_placers).thirdPlace
|
||||
elsif bracket_position_size("Semis") > 0
|
||||
return PlacementPoints.new(@number_of_placers).fourthPlace
|
||||
elsif won_bracket_position_size("5/6") > 0
|
||||
return PlacementPoints.new(@number_of_placers).fifthPlace
|
||||
elsif bracket_position_size("5/6") > 0
|
||||
return PlacementPoints.new(@number_of_placers).sixthPlace
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
def bracket_position_size(bracket_position_name)
|
||||
@wrestler.all_matches.select{|m| m.bracket_position == bracket_position_name}.size
|
||||
end
|
||||
|
||||
def won_bracket_position_size(bracket_position_name)
|
||||
@wrestler.matches_won.select{|m| m.bracket_position == bracket_position_name}.size
|
||||
end
|
||||
end
|
||||
53
app/services/wrestler_services/placement_points.rb
Normal file
53
app/services/wrestler_services/placement_points.rb
Normal file
@@ -0,0 +1,53 @@
|
||||
class PlacementPoints
|
||||
def initialize(number_of_placers)
|
||||
@number_of_placers = number_of_placers
|
||||
end
|
||||
|
||||
def firstPlace
|
||||
if @number_of_placers == 4
|
||||
return 14
|
||||
else
|
||||
return 16
|
||||
end
|
||||
end
|
||||
|
||||
def secondPlace
|
||||
if @number_of_placers == 4
|
||||
return 10
|
||||
else
|
||||
return 12
|
||||
end
|
||||
end
|
||||
|
||||
def thirdPlace
|
||||
if @number_of_placers == 4
|
||||
return 9
|
||||
else
|
||||
return 7
|
||||
end
|
||||
end
|
||||
|
||||
def fourthPlace
|
||||
if @number_of_placers == 4
|
||||
return 4
|
||||
else
|
||||
return 7
|
||||
end
|
||||
end
|
||||
|
||||
def fifthPlace
|
||||
5
|
||||
end
|
||||
|
||||
def sixthPlace
|
||||
3
|
||||
end
|
||||
|
||||
def seventhPlace
|
||||
2
|
||||
end
|
||||
|
||||
def eighthPlace
|
||||
1
|
||||
end
|
||||
end
|
||||
@@ -48,120 +48,72 @@ class PoolBracketPlacementPoints
|
||||
|
||||
def fourPoolsToQuarter
|
||||
if bracket_position_size("Semis") > 0
|
||||
return fourthPlace
|
||||
return PlacementPoints.new(number_of_placers).fourthPlace
|
||||
end
|
||||
if bracket_position_size("Quarter") > 0
|
||||
return eighthPlace
|
||||
return PlacementPoints.new(number_of_placers).eighthPlace
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
def twoPoolsToSemi
|
||||
if bracket_position_size("Semis") > 0
|
||||
return fourthPlace
|
||||
return PlacementPoints.new(number_of_placers).fourthPlace
|
||||
end
|
||||
if bracket_position_size("Conso Semis") > 0
|
||||
return eighthPlace
|
||||
return PlacementPoints.new(number_of_placers).eighthPlace
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
def fourPoolsToSemi
|
||||
if bracket_position_size("Semis") > 0
|
||||
return fourthPlace
|
||||
return PlacementPoints.new(number_of_placers).fourthPlace
|
||||
end
|
||||
if bracket_position_size("Conso Semis") > 0
|
||||
return eighthPlace
|
||||
return PlacementPoints.new(number_of_placers).eighthPlace
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
def onePool
|
||||
if @wrestler.pool_placement == 1
|
||||
return firstPlace
|
||||
return PlacementPoints.new(number_of_placers).firstPlace
|
||||
elsif @wrestler.pool_placement == 2
|
||||
return secondPlace
|
||||
return PlacementPoints.new(number_of_placers).secondPlace
|
||||
elsif @wrestler.pool_placement == 3
|
||||
return thirdPlace
|
||||
return PlacementPoints.new(number_of_placers).thirdPlace
|
||||
elsif @wrestler.pool_placement == 4
|
||||
return fourthPlace
|
||||
return PlacementPoints.new(number_of_placers).fourthPlace
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
def finalMatchPoints
|
||||
if won_bracket_position_size("1/2") > 0
|
||||
return firstPlace
|
||||
return PlacementPoints.new(number_of_placers).firstPlace
|
||||
end
|
||||
if won_bracket_position_size("3/4") > 0
|
||||
return thirdPlace
|
||||
return PlacementPoints.new(number_of_placers).thirdPlace
|
||||
end
|
||||
if won_bracket_position_size("5/6") > 0
|
||||
return fifthPlace
|
||||
return PlacementPoints.new(number_of_placers).fifthPlace
|
||||
end
|
||||
if won_bracket_position_size("7/8") > 0
|
||||
return seventhPlace
|
||||
return PlacementPoints.new(number_of_placers).seventhPlace
|
||||
end
|
||||
if bracket_position_size("1/2") > 0
|
||||
return secondPlace
|
||||
return PlacementPoints.new(number_of_placers).secondPlace
|
||||
end
|
||||
if bracket_position_size("3/4") > 0
|
||||
return fourthPlace
|
||||
return PlacementPoints.new(number_of_placers).fourthPlace
|
||||
end
|
||||
if bracket_position_size("5/6") > 0
|
||||
return sixthPlace
|
||||
return PlacementPoints.new(number_of_placers).sixthPlace
|
||||
end
|
||||
if bracket_position_size("7/8") > 0
|
||||
return eighthPlace
|
||||
return PlacementPoints.new(number_of_placers).eighthPlace
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
def firstPlace
|
||||
if number_of_placers == 4
|
||||
return 14
|
||||
else
|
||||
return 16
|
||||
end
|
||||
end
|
||||
|
||||
def secondPlace
|
||||
if number_of_placers == 4
|
||||
return 10
|
||||
else
|
||||
return 12
|
||||
end
|
||||
end
|
||||
|
||||
def thirdPlace
|
||||
if number_of_placers == 4
|
||||
return 9
|
||||
else
|
||||
return 7
|
||||
end
|
||||
end
|
||||
|
||||
def fourthPlace
|
||||
if number_of_placers == 4
|
||||
return 4
|
||||
else
|
||||
return 7
|
||||
end
|
||||
end
|
||||
|
||||
def fifthPlace
|
||||
5
|
||||
end
|
||||
|
||||
def sixthPlace
|
||||
3
|
||||
end
|
||||
|
||||
def seventhPlace
|
||||
2
|
||||
end
|
||||
|
||||
def eighthPlace
|
||||
1
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user