summaryrefslogtreecommitdiff
path: root/app/models/tournament_stage.rb
diff options
context:
space:
mode:
authorguntasgrewal <guntasgrewal@gmail.com>2014-04-22 19:12:31 -0400
committerguntasgrewal <guntasgrewal@gmail.com>2014-04-22 19:12:31 -0400
commit3e86ffe1113a096541ea94567bffee79368fb863 (patch)
tree7e531c0fa074f744fc21dbc06b38de6b0cae5efe /app/models/tournament_stage.rb
parent42aa0fe7fdfc51f79cda90c4d71621a797995a6c (diff)
Added Pairing Algorithms
Diffstat (limited to 'app/models/tournament_stage.rb')
-rw-r--r--app/models/tournament_stage.rb38
1 files changed, 38 insertions, 0 deletions
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