1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
module Scoring module WinnerTakesAll def self.stats_needed return ["win"] end def self.score(match) scores = {} match.users.each do |user| stats = Statistic.where(user: user, match: match) scores[user] = stats.where(name: "win").first.value ? 1 : 0 end scores end end end