mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-05 06:07:20 +00:00
Composed the poolToBracket method. It should simply read as an outline of how to do its job.
This commit is contained in:
@@ -13,12 +13,9 @@ class Tournamentmatchgen
|
|||||||
end
|
end
|
||||||
|
|
||||||
def poolToBracket
|
def poolToBracket
|
||||||
destroyMatches()
|
destroyMatches
|
||||||
@tournament.weights.sort_by{|x|[x.max]}.each do |w|
|
buildTournamentWeights
|
||||||
buildTournamentWeights(w)
|
generateMatches
|
||||||
end
|
|
||||||
@matches = Boutgen.new.assignBouts(@matches,@tournament.weights)
|
|
||||||
@matches = Losernamegen.new.assignLoserNames(@matches,@tournament.weights)
|
|
||||||
saveMatches
|
saveMatches
|
||||||
return @matches
|
return @matches
|
||||||
end
|
end
|
||||||
@@ -28,13 +25,22 @@ class Tournamentmatchgen
|
|||||||
@matches = []
|
@matches = []
|
||||||
end
|
end
|
||||||
|
|
||||||
def buildTournamentWeights(weight)
|
def buildTournamentWeights
|
||||||
@wrestlers = weight.wrestlers
|
@tournament.weights.sort_by{|x|[x.max]}.each do |weight|
|
||||||
@matches = Pool.new.generatePools(weight, @tournament.id, @matches)
|
@wrestlers = weight.wrestlers
|
||||||
@weight_matches = @matches.select{|m| m.weight_id == weight.id }
|
@matches = Pool.new.generatePools(weight, @tournament.id, @matches)
|
||||||
@last_match = @weight_matches.sort_by{|m| m.round}.last
|
@weight_matches = @matches.select{|m| m.weight_id == weight.id }
|
||||||
@highest_round = @last_match.round
|
@last_match = @weight_matches.sort_by{|m| m.round}.last
|
||||||
@matches = Poolbracket.new.generateBracketMatches(@matches, weight, @highest_round)
|
@highest_round = @last_match.round
|
||||||
|
@matches = Poolbracket.new.generateBracketMatches(@matches, weight, @highest_round)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def generateMatches
|
||||||
|
@matches =
|
||||||
|
Losernamegen.new.assignLoserNames(
|
||||||
|
Boutgen.new.assignBouts(@matches, @tournament.weights),
|
||||||
|
@tournament.weights)
|
||||||
end
|
end
|
||||||
|
|
||||||
def saveMatches
|
def saveMatches
|
||||||
@@ -43,4 +49,5 @@ class Tournamentmatchgen
|
|||||||
m.save
|
m.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user