1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-13 08:32:47 +00:00

Making progress on generating matches.

This commit is contained in:
2014-12-18 10:45:49 -05:00
parent 1899218798
commit 90b96bb218
5 changed files with 43 additions and 394 deletions

View File

@@ -2,5 +2,32 @@ class Weight < ActiveRecord::Base
belongs_to :tournament
has_many :wrestlers, dependent: :destroy
attr_accessor :pools
def generatePool
@wrestlers = Wrestler.where(weight_id: self.id)
poolNumber(@wrestlers)
@wrestlers.each do |wrestler|
puts wrestler.inspect
end
puts 'Pool size:'
puts self.pools
end
def poolNumber(wrestlers)
if wrestlers.size <= 5
self.pools = 1
elsif (wrestlers.size > 5) && (wrestlers.size <= 8)
self.pools = 2
elsif (wrestlers.size > 8) && (wrestlers.size <= 16)
self.pools = 4
end
end
def fourPool
end
end