mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Added functionality for a tournament director to move a wrestler to a pool that has a bye for greater flexibility
This commit is contained in:
@@ -17,6 +17,18 @@ class Weight < ActiveRecord::Base
|
||||
# self.tournament.destroyAllMatches
|
||||
end
|
||||
|
||||
def pools_with_bye
|
||||
pool = 1
|
||||
pools_with_a_bye = []
|
||||
until pool > self.pools do
|
||||
if wrestlersForPool(pool).first.hasAPoolBye
|
||||
pools_with_a_bye << pool
|
||||
end
|
||||
pool = pool + 1
|
||||
end
|
||||
pools_with_a_bye
|
||||
end
|
||||
|
||||
def wrestlersForPool(poolNumber)
|
||||
#For some reason this does not work
|
||||
# wrestlers.select{|w| w.pool == poolNumber}
|
||||
@@ -97,5 +109,9 @@ class Weight < ActiveRecord::Base
|
||||
def poolOrder(pool)
|
||||
PoolOrder.new(wrestlersForPool(pool)).getPoolOrder
|
||||
end
|
||||
|
||||
def wrestlersWithoutPool
|
||||
wrestlers.select{|w| w.pool == nil}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user