From 3e86ffe1113a096541ea94567bffee79368fb863 Mon Sep 17 00:00:00 2001 From: guntasgrewal Date: Tue, 22 Apr 2014 19:12:31 -0400 Subject: Added Pairing Algorithms --- app/models/tournament_stage.rb | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'app/models') diff --git a/app/models/tournament_stage.rb b/app/models/tournament_stage.rb index 9fa6dcd..a3ee7df 100644 --- a/app/models/tournament_stage.rb +++ b/app/models/tournament_stage.rb @@ -22,6 +22,22 @@ class TournamentStage < ActiveRecord::Base return @scheduling.graph end + def pair + set_pairing + return @pairing.pair(matches, players) + end + + def score + set_scoring + #populating the user scores in the database form what you get from @scoring.score(match, interface) + end + + #populate the statistics interface (with populating method) + def populate + set_populating + #? + end + private def set_scheduling if @scheduling.nil? @@ -30,4 +46,26 @@ class TournamentStage < ActiveRecord::Base end return @scheduling end + + private + def set_pairing + if @pairing.nil? + if(@tournament.randomized_teams) + require "pairing/#{self.pairing}" + @pairing = "Pairing::RandomPairing" + return @pairing + #elsif(setTeams) + #@pairing = Pre built + #return @pairing + end + end + end + + private + def set_scoring + end + + private + def set_populating + end end -- cgit v1.2.3-2-g168b