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

Boutgen is dead. Tournaments can assign their own bout numbers.

This commit is contained in:
RJ Osborne
2015-05-27 23:04:17 -04:00
parent 902685ea51
commit 25c92a125d
3 changed files with 14 additions and 17 deletions

View File

@@ -40,4 +40,17 @@ class Tournament < ActiveRecord::Base
matches.destroy_all
end
def matchesByRound(round)
matches.joins(:weight).where(round: round).order("weights.max")
end
def assignBouts
bout_counts = Hash.new(0)
matches.each do |m|
m.bout_number = m.round * 1000 + bout_counts[m.round]
bout_counts[m.round] += 1
m.save!
end
end
end