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