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

Fixed totalRounds in weight

This commit is contained in:
2015-04-01 13:44:01 +00:00
parent 9b9f6a0353
commit 451e6911f8

View File

@@ -123,7 +123,16 @@ class Weight < ActiveRecord::Base
def totalRounds(matches)
@matchups = matches.select{|m| m.weight_id == self.id}
return @matchups.sort_by{|m| m.round}.last.round
@lastRound = matches.sort_by{|m| m.round}.last.round
@count = 0
@round =1
until @round > @lastRound do
if @matchups.select{|m| m.round == @round}
@count = @count + 1
end
@round = @round + 1
end
return @count
end
end