blob: 07753054d571fd6bdae878c6fd26d912b926f61e (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
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(highlight_user)
set_scheduling
return @scheduling.graph(highlight_user)
end
def pair
set_pairing
return @pairing.pair(matches, players)
end
def score
set_scoring
#populating the user scores in the database form what you get from @scoring.score(match, interface)
end
#populate the statistics interface (with populating method)
def populate
set_populating
#?
end
private
def set_scheduling
if @scheduling.nil?
@scheduling = "Scheduling::#{self.scheduling.capitalize}".constantize.new(self)
end
return @scheduling
end
private
def set_pairing
if @pairing.nil?
if(@tournament.randomized_teams)
@pairing = "Pairing::RandomPairing"
#elsif(setTeams)
#@pairing = Pre built
#return @pairing
end
end
return @pairing
end
private
def set_scoring
end
private
def set_populating
end
end
|