1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-05-15 17:59:39 +00:00

This fixes a bug where moving from two pools to four did not work

This commit is contained in:
2019-02-05 14:15:09 +00:00
parent d0cf5301e2
commit 80ae130aa8
2 changed files with 11 additions and 0 deletions

View File

@@ -38,6 +38,15 @@ class Weight < ActiveRecord::Base
weight_wrestlers.select{|w| w.pool == pool_number} weight_wrestlers.select{|w| w.pool == pool_number}
end 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) def all_pool_matches_finished(pool)
@wrestlers = wrestlers_in_pool(pool) @wrestlers = wrestlers_in_pool(pool)
@wrestlers.each do |w| @wrestlers.each do |w|

View File

@@ -7,6 +7,8 @@ class GeneratePoolNumbers
@weight.wrestlers.each do |wrestler| @weight.wrestlers.each do |wrestler|
if wrestler.pool and (wrestler.pool) > (@weight.pools) if wrestler.pool and (wrestler.pool) > (@weight.pools)
resetPool resetPool
elsif @weight.one_pool_empty
resetPool
end end
end end
if @weight.pools == 4 if @weight.pools == 4