From a528cedd36c77487496147b5880205799dbcb242 Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Mon, 28 Apr 2014 15:03:50 -0400 Subject: I fixed it. added self and fixed variable names. --- app/models/match.rb | 2 +- lib/scoring/marginal_peer.rb | 4 ++-- lib/scoring/winner_takes_all.rb | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/match.rb b/app/models/match.rb index 1127598..4c7acbf 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -56,7 +56,7 @@ class Match < ActiveRecord::Base needed = self.tournament_stage.scoring.stats_needed methods_names = self.tournament_stage.tournament.sampling_methods methods_names.each do |method_name| - method_class = "Sampling::#{sampling_name.camelcase}".constantize + method_class = "Sampling::#{method_name.camelcase}".constantize needed.each do |stat| data[stat] ||= {} data[stat][method] = method_class.can_get?(user, stat) diff --git a/lib/scoring/marginal_peer.rb b/lib/scoring/marginal_peer.rb index 13e1796..aa05f5e 100644 --- a/lib/scoring/marginal_peer.rb +++ b/lib/scoring/marginal_peer.rb @@ -1,10 +1,10 @@ module Scoring module MarginalPeer - def stats_needed + def self.stats_needed return [:rating] end - def score(match, interface) + def self.score(match, interface) scores = {} match.players.each do |player| scores[player.user_name] = interface.get_statistic(match, player, :rating) diff --git a/lib/scoring/winner_takes_all.rb b/lib/scoring/winner_takes_all.rb index 517dfd6..bf95781 100644 --- a/lib/scoring/winner_takes_all.rb +++ b/lib/scoring/winner_takes_all.rb @@ -1,10 +1,10 @@ module Scoring module WinnerTakesAll - def stats_needed + def self.stats_needed return [] end - def score(match, interface) + def self.score(match, interface) scores = {} match.players.each do |player| scores[player.user_name] = score_user(match.win?(player)) @@ -13,7 +13,7 @@ module Scoring end private - def score_user(win) + def self.score_user(win) win.nil? ? 0.5 : win ? 1 : 0 end end -- cgit v1.2.3