mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-20 14:09:17 +00:00
move some variables to method scope
This commit is contained in:
@@ -9,7 +9,7 @@ class Tournamentmatchgen
|
|||||||
if @tournament.tournament_type == "Pool to bracket"
|
if @tournament.tournament_type == "Pool to bracket"
|
||||||
@matches = poolToBracket()
|
@matches = poolToBracket()
|
||||||
end
|
end
|
||||||
return @matches
|
@matches
|
||||||
end
|
end
|
||||||
|
|
||||||
def poolToBracket
|
def poolToBracket
|
||||||
@@ -17,7 +17,7 @@ class Tournamentmatchgen
|
|||||||
buildTournamentWeights
|
buildTournamentWeights
|
||||||
generateMatches
|
generateMatches
|
||||||
saveMatches
|
saveMatches
|
||||||
return @matches
|
@matches
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroyMatches
|
def destroyMatches
|
||||||
@@ -27,12 +27,11 @@ class Tournamentmatchgen
|
|||||||
|
|
||||||
def buildTournamentWeights
|
def buildTournamentWeights
|
||||||
@tournament.weights.sort_by{|x|[x.max]}.each do |weight|
|
@tournament.weights.sort_by{|x|[x.max]}.each do |weight|
|
||||||
@wrestlers = weight.wrestlers
|
|
||||||
@matches = Pool.new.generatePools(weight, @tournament.id, @matches)
|
@matches = Pool.new.generatePools(weight, @tournament.id, @matches)
|
||||||
@weight_matches = @matches.select{|m| m.weight_id == weight.id }
|
weight_matches = @matches.select{|m| m.weight_id == weight.id }
|
||||||
@last_match = @weight_matches.sort_by{|m| m.round}.last
|
last_match = weight_matches.sort_by{|m| m.round}.last
|
||||||
@highest_round = @last_match.round
|
highest_round = last_match.round
|
||||||
@matches = Poolbracket.new.generateBracketMatches(@matches, weight, @highest_round)
|
@matches = Poolbracket.new.generateBracketMatches(@matches, weight, highest_round)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user