1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Fixed issue with wrestlers having a pool number higher than possible when bracket types change after deleting wrestlers

This commit is contained in:
2019-01-19 16:18:20 +00:00
parent 30dc645375
commit 4eb75d45d3
3 changed files with 74 additions and 24 deletions

View File

@@ -90,6 +90,26 @@ class Weight < ActiveRecord::Base
end
end
def pool_full(pool)
current_wrestlers = wrestlers_in_pool(pool)
if self.pool_bracket_type == "twoPoolsToSemi"
max = 4
elsif self.pool_bracket_type == "twoPoolsToFinal"
max = 5
elsif self.pool_bracket_type == "fourPoolsToQuarter"
max = 3
elsif self.pool_bracket_type == "fourPoolsToSemi"
max = 4
elsif self.pool_bracket_type == "eightPoolsToQuarter"
max = 3
end
if max == current_wrestlers
true
else
false
end
end
def pool_rounds(matches)
matchups = matches.select{|m| m.weight_id == self.id}
pool_matches = matchups.select{|m| m.bracket_position == "Pool"}