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

Created integration test for poolbracket matchups

This commit is contained in:
2015-03-27 12:52:35 +00:00
parent 819d735480
commit 4b6b20c912
5 changed files with 94 additions and 6 deletions

View File

@@ -7,7 +7,7 @@ class Matchup
hash
end
def convert_to_obj(h)
def convert_to_obj(h)
h.each do |k,v|
self.class.send(:attr_accessor, k)
instance_variable_set("@#{k}", v)

View File

@@ -31,10 +31,10 @@ class Tournament < ActiveRecord::Base
def generateMatchups
@matches = []
self.weights.map.sort_by{|x|[x.max]}.each do |weight|
@upcomingMatches = weight.generateMatchups(@matches)
@matches = weight.generateMatchups(@matches)
end
@upcomingMatches = assignBouts(@upcomingMatches)
return @upcomingMatches
@matches = assignBouts(@matches)
return @matches
end
def assignBouts(matches)

View File

@@ -92,9 +92,9 @@ class Weight < ActiveRecord::Base
return "twoPoolsToSemi"
elsif self.wrestlers.size > 8 && self.wrestlers.size <= 10
return "twoPoolsToFinal"
elsif self.wrestlers.size == 11
elsif self.wrestlers.size == 11 || self.wrestlers.size == 12
return "fourPoolsToQuarter"
elsif self.wrestlers.size > 11 && self.wrestlers.size <= 16
elsif self.wrestlers.size > 12 && self.wrestlers.size <= 16
return "fourPoolsToSemi"
end
end