blob: 9fa6dcd3d8f6d71ae5da862aa6dbec37dad9bc51 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
class TournamentStage < ActiveRecord::Base
belongs_to :tournament
has_many :matches
def matches_ordered
h = {}
i = 1
self.matches.order(:id).each do |m|
h[i] = m
i += 1
end
return h
end
def create_matches
set_scheduling
@scheduling.create_matches
end
def to_svg
set_scheduling
return @scheduling.graph
end
private
def set_scheduling
if @scheduling.nil?
require "scheduling/#{self.scheduling}"
@scheduling = "Scheduling::#{self.scheduling.capitalize}".constantize.new(self)
end
return @scheduling
end
end
|