mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
This fixes a bug where moving from two pools to four did not work
This commit is contained in:
@@ -37,6 +37,15 @@ class Weight < ActiveRecord::Base
|
||||
weight_wrestlers = Wrestler.where(:weight_id => self.id)
|
||||
weight_wrestlers.select{|w| w.pool == pool_number}
|
||||
end
|
||||
|
||||
def one_pool_empty
|
||||
(1..self.pools).each do |pool|
|
||||
if wrestlers_in_pool(pool).size < 1
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def all_pool_matches_finished(pool)
|
||||
@wrestlers = wrestlers_in_pool(pool)
|
||||
|
||||
@@ -7,6 +7,8 @@ class GeneratePoolNumbers
|
||||
@weight.wrestlers.each do |wrestler|
|
||||
if wrestler.pool and (wrestler.pool) > (@weight.pools)
|
||||
resetPool
|
||||
elsif @weight.one_pool_empty
|
||||
resetPool
|
||||
end
|
||||
end
|
||||
if @weight.pools == 4
|
||||
|
||||
Reference in New Issue
Block a user