mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-04 05:43:47 +00:00
Added team abbreviation
This commit is contained in:
@@ -99,6 +99,23 @@ class Match < ActiveRecord::Base
|
||||
self.loser2_name
|
||||
end
|
||||
end
|
||||
|
||||
def w1_bracket_name
|
||||
if self.w1 != nil
|
||||
return "#{w1_name} (#{wrestler1.school.abbreviation})"
|
||||
else
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
def w2_bracket_name
|
||||
if self.w2 != nil
|
||||
return "#{w2_name} (#{wrestler2.school.abbreviation})"
|
||||
else
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
def winner_name
|
||||
if self.finished != 1
|
||||
return ""
|
||||
@@ -110,6 +127,15 @@ class Match < ActiveRecord::Base
|
||||
return self.w2_name
|
||||
end
|
||||
end
|
||||
|
||||
def bracket_winner_name
|
||||
if winner_name != ""
|
||||
return "#{winner_name} (#{Wrestler.find(winner_id).school.abbreviation})"
|
||||
else
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
def weight_max
|
||||
self.weight.max
|
||||
end
|
||||
|
||||
@@ -11,6 +11,15 @@ class School < ActiveRecord::Base
|
||||
before_destroy do
|
||||
self.tournament.destroy_all_matches
|
||||
end
|
||||
|
||||
def abbreviation
|
||||
name_array = self.name.split(' ')
|
||||
if name_array.size > 1
|
||||
return "#{name_array[0].chars.to_a.first}#{name_array[1].chars.to_a[0..1].join('').upcase}"
|
||||
else
|
||||
return "#{name_array[0].chars.to_a[0..2].join('').upcase}"
|
||||
end
|
||||
end
|
||||
|
||||
#calculate score here
|
||||
def page_score_string
|
||||
|
||||
Reference in New Issue
Block a user