mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-05-19 11:33:49 +00:00
Boutgen is dead. Tournaments can assign their own bout numbers.
This commit is contained in:
@@ -1,16 +0,0 @@
|
|||||||
class Boutgen
|
|
||||||
|
|
||||||
def matchesByRound(tournament, round)
|
|
||||||
tournament.matches.joins(:weight).where(round: round).order("weights.max")
|
|
||||||
end
|
|
||||||
|
|
||||||
def assignBouts(tournament)
|
|
||||||
bout_counts = Hash.new(0)
|
|
||||||
matches = tournament.matches.each do |m|
|
|
||||||
m.bout_number = m.round * 1000 + bout_counts[m.round]
|
|
||||||
bout_counts[m.round] += 1
|
|
||||||
m.save!
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -40,4 +40,17 @@ class Tournament < ActiveRecord::Base
|
|||||||
matches.destroy_all
|
matches.destroy_all
|
||||||
end
|
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
|
end
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class Tournamentmatchgen
|
|||||||
end
|
end
|
||||||
|
|
||||||
def generateMatches
|
def generateMatches
|
||||||
Boutgen.new.assignBouts(@tournament)
|
@tournament.assignBouts
|
||||||
Losernamegen.new.assignLoserNames(@tournament)
|
Losernamegen.new.assignLoserNames(@tournament)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user