1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-22 14:32:22 +00:00

Fixed bug in pooladvance and refactored

This commit is contained in:
2015-12-03 20:27:38 +00:00
parent b334c1fad3
commit 5898393fac
3 changed files with 61 additions and 47 deletions

View File

@@ -39,6 +39,23 @@ class Wrestler < ActiveRecord::Base
unfinishedMatches.first
end
def nextMatchPositionNumber
pos = lastMatch.bracket_position_number
return (pos/2.0)
end
def lastMatch
finishedMatches.sort_by{|m| m.round}.reverse.first
end
def winnerOfLastMatch?
if lastMatch.winner_id == self.id
return true
else
return false
end
end
def nextMatchBoutNumber
if nextMatch
nextMatch.bout_number
@@ -155,8 +172,6 @@ class Wrestler < ActiveRecord::Base
end
def advanceInBracket
@advance = Pooladvance.new
@advance.wrestler = self
@advance.advanceWrestler
Pooladvance.new(self).advanceWrestler
end
end