1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-08 07:22:38 +00:00

Calculate matchups for pools. This breaks generating matches.

This commit is contained in:
2015-03-12 15:03:38 -04:00
parent d68cebc6e4
commit dc9639cf1c
5 changed files with 73 additions and 21 deletions

View File

@@ -47,5 +47,21 @@ class Weight < ActiveRecord::Base
end
self.wrestlers.size
end
def generateMatchups(matches)
@wrestlers = Wrestler.where(weight_id: self.id)
#@wrestlers.sort_by{|w| [w.original_seed]}
if self.pools == 1
@pool = Pool.new
@matches = @pool.onePool(@wrestlers,self.id,self.tournament_id,matches)
elsif self.pools == 2
@pool = Pool.new
@matches = @pool.twoPools(@wrestlers,self.id,self.tournament_id,matches)
elsif self.pools == 4
@pool = Pool.new
@matches = @pool.fourPools(@wrestlers,self.id,self.tournament_id,matches)
end
return @matches
end
end