summaryrefslogtreecommitdiff
path: root/lib/scoring/winner_takes_all.rb
blob: c807cba7dea8290cda9b4707e2bb906a7b6edb99 (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
			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