diff options
author | AndrewMurrell <amurrel@purdue.edu> | 2014-04-29 16:11:57 -0400 |
---|---|---|
committer | AndrewMurrell <amurrel@purdue.edu> | 2014-04-29 16:11:57 -0400 |
commit | eed512268e4e0a0b7c5f9dddd6e36773fbee6bad (patch) | |
tree | d806a402c3379e9fd1357d2e72620d10c9c1f4f1 | |
parent | 577f203243b1ac914a3ee3f4635005be06d637c6 (diff) |
scoring accepts matches
-rw-r--r-- | app/models/match.rb | 4 | ||||
-rw-r--r-- | lib/scoring/README.md | 2 | ||||
-rw-r--r-- | lib/scoring/fibonacci_peer_with_blowout.rb | 4 | ||||
-rw-r--r-- | lib/scoring/marginal_peer.rb | 2 | ||||
-rw-r--r-- | lib/scoring/winner_takes_all.rb | 2 |
5 files changed, 7 insertions, 7 deletions
diff --git a/app/models/match.rb b/app/models/match.rb index 7b36777..1359695 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -19,7 +19,7 @@ class Match < ActiveRecord::Base # such that the match may be considered finished. def finished? ok = true - tournament_stage.scoring.stats_needed.each do |stat| + tournament_stage.scoring.stats_needed(self).each do |stat| ok &= !statistics.where(match: self, name: stat).nil? end ok @@ -80,7 +80,7 @@ class Match < ActiveRecord::Base def figure_sampling_methods if @sampling_methods.nil? data = {} - needed = self.tournament_stage.scoring.stats_needed + needed = self.tournament_stage.scoring.stats_needed(self) methods_names = self.tournament_stage.tournament.sampling_methods methods_names.each do |method_name| method_class = "Sampling::#{method_name.camelcase}".constantize diff --git a/lib/scoring/README.md b/lib/scoring/README.md index dce71d0..efdc3cc 100644 --- a/lib/scoring/README.md +++ b/lib/scoring/README.md @@ -4,7 +4,7 @@ Scoring interface Files in this directory should be _modules_ implementing the following interface: - - `stats_needed(Match) => Array[]=Symbol` + - `stats_needed(Match) => Array[]=String` Returns which statistics need to be collected for this scoring algorithm. diff --git a/lib/scoring/fibonacci_peer_with_blowout.rb b/lib/scoring/fibonacci_peer_with_blowout.rb index ea4dec5..a13d76c 100644 --- a/lib/scoring/fibonacci_peer_with_blowout.rb +++ b/lib/scoring/fibonacci_peer_with_blowout.rb @@ -1,7 +1,7 @@ module Scoring module FibonacciPeerWithBlowout - def self.stats_needed - return ["votes", "win", "blowout"] + @match.users.map{|u|"review_from_#{u.user_name}"} + def self.stats_needed(match) + return ["votes", "win", "blowout"] + match.users.map{|u|"review_from_#{u.user_name}"} end def self.score(match) diff --git a/lib/scoring/marginal_peer.rb b/lib/scoring/marginal_peer.rb index 8559b3d..f2c0272 100644 --- a/lib/scoring/marginal_peer.rb +++ b/lib/scoring/marginal_peer.rb @@ -1,6 +1,6 @@ module Scoring module MarginalPeer - def self.stats_needed + def self.stats_needed(match) return ["rating", "win"] end diff --git a/lib/scoring/winner_takes_all.rb b/lib/scoring/winner_takes_all.rb index 5fc188a..db494c6 100644 --- a/lib/scoring/winner_takes_all.rb +++ b/lib/scoring/winner_takes_all.rb @@ -1,6 +1,6 @@ module Scoring module WinnerTakesAll - def self.stats_needed + def self.stats_needed(match) return ["win"] end |