mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Formatting code and deleting uneeded methods
This commit is contained in:
@@ -27,35 +27,11 @@ class Weight < ActiveRecord::Base
|
||||
return @wrestler.poolNumber
|
||||
end
|
||||
|
||||
def fourPoolNumbers(wrestlers)
|
||||
@pool = 1
|
||||
wrestlers.sort_by{|x|[x.original_seed]}.reverse.each do |w|
|
||||
if w.original_seed == 3
|
||||
w.poolNumber = 3
|
||||
elsif w.original_seed == 4
|
||||
w.poolNumber = 4
|
||||
elsif w.original_seed == 1
|
||||
w.poolNumber = 1
|
||||
elsif w.original_seed == 2
|
||||
w.poolNumber = 2
|
||||
else
|
||||
w.poolNumber = @pool
|
||||
end
|
||||
if @pool < 4
|
||||
@pool = @pool + 1
|
||||
else
|
||||
@pool =1
|
||||
end
|
||||
end
|
||||
return wrestlers
|
||||
end
|
||||
|
||||
def onePoolNumbers(wrestlers)
|
||||
wrestlers.sort_by{|x|[x.original_seed]}.each do |w|
|
||||
w.poolNumber = 1
|
||||
end
|
||||
return wrestlers
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Wrestler < ActiveRecord::Base
|
||||
belongs_to :school
|
||||
belongs_to :weight
|
||||
attr_accessor :matches_all, :isWrestlingThisRound, :boutByRound, :seasonWinPercentage, :poolNumber
|
||||
attr_accessor :allMatches, :isWrestlingThisRound, :boutByRound, :seasonWinPercentage
|
||||
|
||||
def isWrestlingThisRound(matchRound)
|
||||
@gMatches = Match.where(g_id: self.id, round: matchRound)
|
||||
@@ -28,13 +28,13 @@ class Wrestler < ActiveRecord::Base
|
||||
return @match.boutNumber
|
||||
end
|
||||
end
|
||||
|
||||
def matches_all
|
||||
@gMatches = Match.where(g_id: self.id)
|
||||
@rMatches = Match.where(r_id: self.id)
|
||||
return @gMatches + @rMatches
|
||||
|
||||
def allMatches(matches)
|
||||
@matches = matches.select{|m| m.w1 == self.id || m.w2 == self.id}
|
||||
return @matches
|
||||
end
|
||||
|
||||
|
||||
def seasonWinPercentage
|
||||
@win = self.season_win.to_f
|
||||
@loss = self.season_loss.to_f
|
||||
@@ -48,7 +48,6 @@ class Wrestler < ActiveRecord::Base
|
||||
elsif self.season_win == nil or self.season_loss == nil
|
||||
return 0
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user