blob: fa15980c37bd46f3eb6055cfad7d13967a97ca0a (
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
|
class Match < ActiveRecord::Base
belongs_to :tournament_stage
has_many :statistics
has_and_belongs_to_many :teams
belongs_to :winner, class_name: "Team"
def setup()
end
def finished?
ok = true
tournament_stage.scoring_method.stats_needed.each do |stat|
ok &= statistics.where(match: self, name: stat).nil?
end
ok
end
def win?(player)
winner.players.include? player
end
def users
ret = []
self.teams.each{|t| ret.concat(t.users)}
return ret
end
def stats_from(sampling_class)
# TODO
end
def handle_sampling(params)
# TODO
end
def render_sampling(user)
# TODO
end
def finished?
# TODO
end
end
|