mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Fixed pooladvance and updated views for when tournament ends
This commit is contained in:
@@ -4,9 +4,11 @@ class Mat < ActiveRecord::Base
|
||||
|
||||
def assignNextMatch
|
||||
t_matches = tournament.matches.where(mat_id: nil)
|
||||
match = t_matches.order(:bout_number).first
|
||||
match.mat_id = self.id
|
||||
match.save
|
||||
if t_matches.size > 0
|
||||
match = t_matches.order(:bout_number).first
|
||||
match.mat_id = self.id
|
||||
match.save
|
||||
end
|
||||
end
|
||||
|
||||
def unfinishedMatches
|
||||
|
||||
@@ -56,11 +56,11 @@ class Pooladvance
|
||||
def updateNewMatch(match)
|
||||
if @wrestler.nextMatchPositionNumber == @wrestler.nextMatchPositionNumber.ceil
|
||||
match.w2 = @wrestler.id
|
||||
match.update
|
||||
match.save
|
||||
end
|
||||
if @wrestler.nextMatchPositionNumber != @wrestler.nextMatchPositionNumber.ceil
|
||||
match.w1 = @wrestler.id
|
||||
match.update
|
||||
match.save
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -157,13 +157,13 @@ class Wrestler < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def seasonWinPercentage
|
||||
@win = self.season_win.to_f
|
||||
@loss = self.season_loss.to_f
|
||||
if @win > 0 and @loss != nil
|
||||
@matchTotal = @win + @loss
|
||||
@percentageDec = @win / @matchTotal
|
||||
@percentage = @percentageDec * 100
|
||||
return @percentage.to_i
|
||||
win = self.season_win.to_f
|
||||
loss = self.season_loss.to_f
|
||||
if win > 0 and loss != nil
|
||||
matchTotal = win + loss
|
||||
percentageDec = win / matchTotal
|
||||
percentage = percentageDec * 100
|
||||
return percentage.to_i
|
||||
elsif self.season_win == 0
|
||||
return 0
|
||||
elsif self.season_win == nil or self.season_loss == nil
|
||||
|
||||
Reference in New Issue
Block a user