blob: a24d7b90a8b9482d95afebfe89efcffb869f269d (
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
|
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(self)
end
private
def set_scheduling
@scheduling ||= "Scheduling::#{self.scheduling}".constantize.new(self)
end
end
|