From 81779246359bfedb690fe924199f6ecb5d746354 Mon Sep 17 00:00:00 2001 From: RJ Osborne Date: Sat, 23 May 2015 05:46:28 -0400 Subject: [PATCH] move some variables to method scope --- app/models/tournamentmatchgen.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/models/tournamentmatchgen.rb b/app/models/tournamentmatchgen.rb index a44b1a2..a26810e 100644 --- a/app/models/tournamentmatchgen.rb +++ b/app/models/tournamentmatchgen.rb @@ -9,7 +9,7 @@ class Tournamentmatchgen if @tournament.tournament_type == "Pool to bracket" @matches = poolToBracket() end - return @matches + @matches end def poolToBracket @@ -17,7 +17,7 @@ class Tournamentmatchgen buildTournamentWeights generateMatches saveMatches - return @matches + @matches end def destroyMatches @@ -27,12 +27,11 @@ class Tournamentmatchgen def buildTournamentWeights @tournament.weights.sort_by{|x|[x.max]}.each do |weight| - @wrestlers = weight.wrestlers @matches = Pool.new.generatePools(weight, @tournament.id, @matches) - @weight_matches = @matches.select{|m| m.weight_id == weight.id } - @last_match = @weight_matches.sort_by{|m| m.round}.last - @highest_round = @last_match.round - @matches = Poolbracket.new.generateBracketMatches(@matches, weight, @highest_round) + weight_matches = @matches.select{|m| m.weight_id == weight.id } + last_match = weight_matches.sort_by{|m| m.round}.last + highest_round = last_match.round + @matches = Poolbracket.new.generateBracketMatches(@matches, weight, highest_round) end end