summaryrefslogtreecommitdiff
path: root/lib/scoring
diff options
context:
space:
mode:
Diffstat (limited to 'lib/scoring')
-rw-r--r--lib/scoring/fibonacci_peer_with_blowout.rb15
-rw-r--r--lib/scoring/marginal_peer.rb9
-rw-r--r--lib/scoring/winner_takes_all.rb10
3 files changed, 18 insertions, 16 deletions
diff --git a/lib/scoring/fibonacci_peer_with_blowout.rb b/lib/scoring/fibonacci_peer_with_blowout.rb
index f592540..9d72643 100644
--- a/lib/scoring/fibonacci_peer_with_blowout.rb
+++ b/lib/scoring/fibonacci_peer_with_blowout.rb
@@ -1,19 +1,18 @@
module Scoring
module FibonacciPeerWithBlowout
def self.stats_needed
- return [:votes, :win, :blowout]
+ return ["votes", "win", "blowout"]
end
def self.score(match)
scores = {}
- match.players.each do |player|
- stats = Statistics.where(user: player, match: match)
+ match.users.each do |user|
+ stats = Statistic.where(user: user, match: match)
- votes = stats.where(name: :votes ).first
- win = stats.where(name: :win ).first
- blowout = stats.where(name: :blowout).first
-
- scores[player] = self.score_user(votes, win, blowout)
+ votes = stats.where(name: "votes" ).first.value
+ win = stats.where(name: "win" ).first.value
+ blowout = stats.where(name: "blowout").first.value
+ scores[user] = self.score_user(votes, win, blowout)
end
scores
end
diff --git a/lib/scoring/marginal_peer.rb b/lib/scoring/marginal_peer.rb
index aa05f5e..8559b3d 100644
--- a/lib/scoring/marginal_peer.rb
+++ b/lib/scoring/marginal_peer.rb
@@ -1,13 +1,14 @@
module Scoring
module MarginalPeer
def self.stats_needed
- return [:rating]
+ return ["rating", "win"]
end
- def self.score(match, interface)
+ def self.score(match)
scores = {}
- match.players.each do |player|
- scores[player.user_name] = interface.get_statistic(match, player, :rating)
+ match.users.each do |user|
+ stats = Statistic.where(user: user, match: match)
+ scores[user] = stats.where(name: "rating").first.value
end
scores
end
diff --git a/lib/scoring/winner_takes_all.rb b/lib/scoring/winner_takes_all.rb
index 57ddae6..9c83fb9 100644
--- a/lib/scoring/winner_takes_all.rb
+++ b/lib/scoring/winner_takes_all.rb
@@ -1,13 +1,15 @@
module Scoring
module WinnerTakesAll
def self.stats_needed
- return ["win"]
+ #return ["win"]
+ ["win", "numDeaths", "turretsKilled", "championsKilled", "minionsKilled", "assists"]
end
- def self.score(match, interface)
+ def self.score(match)
scores = {}
- match.players.each do |player|
- scores[player.user_name] = score_user(player.statistics.where(:match => match, :name => "win").value)
+ match.users.each do |user|
+ stats = Statistic.where(user: user, match: match)
+ scores[user] = score_user(stats.where(name: "win").first.value)
end
scores
end