summaryrefslogtreecommitdiff
path: root/lib/scoring/winner_takes_all.rb
blob: 6cffb28a207d5d6e492a530ad66e3899e459d7f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module Scoring
	module WinnerTakesAll
		def self.stats_needed(match)
			return ["win"]
		end

		def self.score(match)
			scores = {}
			match.users.each do |user|
				stats = Statistic.where(user: user, match: match)
				scores[user] = stats.where(name: "win").first.value ? 1 : 0
			end
			scores
		end
	end
end