summaryrefslogtreecommitdiff
path: root/lib/scoring/winner_takes_all.rb
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-29 08:30:55 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-29 08:30:55 -0400
commitf461002bef30b7bc1751917ab388be8d4eab37d8 (patch)
tree740fc3d0cdaa11102be221f4fca9bd32f3ab9484 /lib/scoring/winner_takes_all.rb
parent284da4d7e5badc0a1ad9dafc52672ab14168c91b (diff)
fix scoring (mostly... I managed to get a 500 while refreshing)
Diffstat (limited to 'lib/scoring/winner_takes_all.rb')
-rw-r--r--lib/scoring/winner_takes_all.rb10
1 files changed, 6 insertions, 4 deletions
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