1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-05 06:07:20 +00:00

Fixed bug with pool to bracket advancement. This bug was conceived due to the removing of tests and logic when making pool and pool_placement database fields.

This commit is contained in:
2019-12-12 11:19:24 -05:00
parent a8361593aa
commit e2ec1d4a8a
6 changed files with 71 additions and 21 deletions

View File

@@ -19,7 +19,8 @@ class Match < ActiveRecord::Base
calculate_school_points
end
end
BRACKET_POSITIONS = ["Pool","1/2","3/4","5/6","7/8","Quarter","Semis","Conso Semis"]
WIN_TYPES = ["Decision", "Major", "Tech Fall", "Pin", "Forfeit", "Injury Default", "Default", "DQ"]
def calculate_school_points
@@ -29,6 +30,13 @@ class Match < ActiveRecord::Base
end
end
def wrestler_in_match(wrestler)
if self.w1 == wrestler.id or self.w2 == wrestler.id
return true
else
return false
end
end
def mat_assigned
if self.mat

View File

@@ -48,8 +48,8 @@ class Weight < ActiveRecord::Base
end
def all_pool_matches_finished(pool)
@wrestlers = wrestlers_in_pool(pool)
@wrestlers.each do |w|
wrestlers = wrestlers_in_pool(pool)
wrestlers.each do |w|
if w.pool_matches.size != w.finished_pool_matches.size
return false
end
@@ -58,14 +58,14 @@ class Weight < ActiveRecord::Base
end
def pools
@wrestlers = self.wrestlers
if @wrestlers.size <= 6
wrestlers = self.wrestlers
if wrestlers.size <= 6
self.pools = 1
elsif (@wrestlers.size > 6) && (@wrestlers.size <= 10)
elsif (wrestlers.size > 6) && (wrestlers.size <= 10)
self.pools = 2
elsif (@wrestlers.size > 10) && (@wrestlers.size <= 16)
elsif (wrestlers.size > 10) && (wrestlers.size <= 16)
self.pools = 4
elsif (@wrestlers.size > 16) && (@wrestlers.size <= 24)
elsif (wrestlers.size > 16) && (wrestlers.size <= 24)
self.pools = 8
end
end