mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-12 00:09:32 +00:00
Fixed totalRounds in weight
This commit is contained in:
@@ -123,7 +123,16 @@ class Weight < ActiveRecord::Base
|
|||||||
|
|
||||||
def totalRounds(matches)
|
def totalRounds(matches)
|
||||||
@matchups = matches.select{|m| m.weight_id == self.id}
|
@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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user