mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
31 lines
525 B
Ruby
31 lines
525 B
Ruby
class Bout
|
|
|
|
|
|
def matchesByRound(round, matches)
|
|
@matches = matches.select {|m| m.round == round}
|
|
return @matches
|
|
end
|
|
|
|
def giveBout(matches)
|
|
@matches = matches.sort_by{|x|[x.weight_max]}
|
|
@matches.each_with_index do |m, i|
|
|
bout = m.round * 1000 + i
|
|
m.boutNumber = bout
|
|
end
|
|
return @matches
|
|
end
|
|
|
|
def assignBouts(matches)
|
|
@round = 1
|
|
until matchesByRound(@round, matches).blank? do
|
|
@matches = matchesByRound(@round, matches)
|
|
giveBout(@matches)
|
|
@round += 1
|
|
end
|
|
return matches
|
|
end
|
|
|
|
|
|
|
|
|
|
end |