blob: a3ee7dfadea13546ce6a1524512845e417d82270 (
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
70
71
|
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
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?
require "scheduling/#{self.scheduling}"
@scheduling = "Scheduling::#{self.scheduling.capitalize}".constantize.new(self)
end
return @scheduling
end
private
def set_pairing
if @pairing.nil?
if(@tournament.randomized_teams)
require "pairing/#{self.pairing}"
@pairing = "Pairing::RandomPairing"
return @pairing
#elsif(setTeams)
#@pairing = Pre built
#return @pairing
end
end
end
private
def set_scoring
end
private
def set_populating
end
end
|