1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-12 16:25:41 +00:00

Moved match generation to a class and added tournament_type to tournaments.

This commit is contained in:
2015-04-27 13:54:57 -04:00
parent 61d1240f0b
commit 37470d9602
12 changed files with 69 additions and 42 deletions

View File

@@ -101,18 +101,6 @@ class Weight < ActiveRecord::Base
return "fourPoolsToSemi"
end
end
def generateMatchups(matches)
@wrestlers = self.wrestlers
@pool = Pool.new
@matches = @pool.generatePools(self.pools,@wrestlers,self,self.tournament_id,matches)
@weight_matches = @matches.select{|m|m.weight_id == self.id}
@last_match = @weight_matches.sort_by{|m| m.round}.last
@highest_round = @last_match.round
@bracket = Poolbracket.new
@matches = @bracket.generateBracketMatches(@matches,self,@highest_round)
return @matches
end
def poolRounds(matches)
@matchups = matches.select{|m| m.weight_id == self.id}