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

Added weight_max to matchup

This commit is contained in:
2015-03-25 13:08:36 +00:00
parent 06a4d1b95d
commit a1fbcc4a9f
4 changed files with 4 additions and 7 deletions

View File

@@ -1,11 +1,6 @@
class Matchup
attr_accessor :w1, :w2, :round, :weight_id, :boutNumber, :w1_name, :w2_name, :bracket_position, :bracket_position_number
attr_accessor :w1, :w2, :round, :weight_id, :boutNumber, :w1_name, :w2_name, :bracket_position, :bracket_position_number, :weight_max
def weight_max
@weight = Weight.find(self.weight_id)
return @weight.max
end
def to_hash
hash = {}
instance_variables.each {|var| hash[var.to_s.delete("@")] = instance_variable_get(var) }

View File

@@ -23,6 +23,7 @@ class Pool
@match.w2_name = b[1].name
@match.weight_id = weight.id
@match.round = index + 1
@match.weight_max = weight.max
matches << @match
end
end

View File

@@ -95,6 +95,7 @@ class Poolbracket
@match.round = round
@match.bracket_position = bracket_position
@match.bracket_position_number = bracket_position_number
@match.weight_max = weight.max
matches << @match
return matches
end

View File

@@ -11,7 +11,7 @@ class Tournament < ActiveRecord::Base
end
def upcomingMatches
if self.matchups_array?
if self.matchups_array
return matchupHashesToObjects(self.matchups_array)
else
@matches = generateMatchups