summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-29 03:42:03 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-29 03:42:03 -0400
commita3a72a54cc5742ffe82611fb87b3445c251d0676 (patch)
tree2976b8c2b6b082b8677ffb96a74170a771a89f46
parentf9488b183bbd41d74d801a9cbdd41410be4ddba5 (diff)
fix up Scoring::FibonacciPeerWithBlowout
-rw-r--r--lib/scoring/fibonacci_peer_with_blowout.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/scoring/fibonacci_peer_with_blowout.rb b/lib/scoring/fibonacci_peer_with_blowout.rb
index 21ffab1..f592540 100644
--- a/lib/scoring/fibonacci_peer_with_blowout.rb
+++ b/lib/scoring/fibonacci_peer_with_blowout.rb
@@ -1,13 +1,19 @@
module Scoring
module FibonacciPeerWithBlowout
def self.stats_needed
- return [:votes]
+ return [:votes, :win, :blowout]
end
def self.score(match)
scores = {}
match.players.each do |player|
- scores[player] = self.score_user(match.statistics.where(user: player, name: :votes).first, match.win?(player), match.blowout)
+ stats = Statistics.where(user: player, 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)
end
scores
end