summaryrefslogtreecommitdiff
path: root/lib/scoring/marginal_peer.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/marginal_peer.rb
parent284da4d7e5badc0a1ad9dafc52672ab14168c91b (diff)
fix scoring (mostly... I managed to get a 500 while refreshing)
Diffstat (limited to 'lib/scoring/marginal_peer.rb')
-rw-r--r--lib/scoring/marginal_peer.rb9
1 files changed, 5 insertions, 4 deletions
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