mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Finished pool advance logic still need tests
This commit is contained in:
@@ -8,28 +8,25 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
@tournament = Tournament.find(1)
|
||||
@tournament.generateMatchups
|
||||
@matches = @tournament.matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"}
|
||||
nineManBracketPoolOne
|
||||
@wrestlers = Wrestler.where("weight_id = ?", 3)
|
||||
@wrestlers.each do |w|
|
||||
w.advanceInBracket
|
||||
end
|
||||
end
|
||||
|
||||
def nineManBracketPoolOne
|
||||
endMatch(1002,"Guy8")
|
||||
endMatch(1003,"Guy10")
|
||||
endMatch(2002,"Guy2")
|
||||
endMatch(2003,"Guy8")
|
||||
endMatch(3003,"Guy2")
|
||||
endMatch(4002,"Guy8")
|
||||
endMatch(4003,"Guy2")
|
||||
endMatch(5002,"Guy2")
|
||||
endMatch(5003,"Guy5")
|
||||
@matches = @tournament.matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"}
|
||||
endMatch(1002,"Guy8",@matches)
|
||||
endMatch(1003,"Guy10",@matches)
|
||||
endMatch(2002,"Guy2",@matches)
|
||||
endMatch(2003,"Guy8",@matches)
|
||||
endMatch(3003,"Guy2",@matches)
|
||||
endMatch(4002,"Guy8",@matches)
|
||||
endMatch(4003,"Guy2",@matches)
|
||||
endMatch(5002,"Guy2",@matches)
|
||||
endMatch(5003,"Guy5",@matches)
|
||||
endMatch(3002,"Guy5",@matches)
|
||||
end
|
||||
|
||||
def endMatch(bout,winner)
|
||||
@match = @matches.select{|m| m.bout_number == bout}.first
|
||||
def endMatch(bout,winner,matches)
|
||||
@match = matches.select{|m| m.bout_number == bout}.first
|
||||
@match.finished = 1
|
||||
@match.winner_id = translateNameToId(winner)
|
||||
@match.win_type = "Decision"
|
||||
@@ -41,6 +38,7 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
||||
|
||||
test "nine man outright finals advance" do
|
||||
@wrestler = Wrestler.where("name = ?", "Guy2").first
|
||||
@match = Match.where("bout_number = ?",6000).first
|
||||
assert_equal 6000, @wrestler.boutByRound(6)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user