summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Gemfile.lock26
-rw-r--r--app/models/tournament_stage.rb38
-rw-r--r--lib/pairing/PairingAlgorithm.rb2
-rw-r--r--lib/scheduling/elimination.rb7
-rw-r--r--lib/scoring/ScoringAlgorithm.rb10
5 files changed, 61 insertions, 22 deletions
diff --git a/Gemfile.lock b/Gemfile.lock
index e0d013b..e7ccedb 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -26,9 +26,8 @@ GEM
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
arel (4.0.2)
- atomic (1.1.16)
bcrypt-ruby (3.1.2)
- bootstrap-sass (3.1.1.0)
+ bootstrap-sass (3.1.1.1)
sass (~> 3.2)
builder (3.1.4)
coffee-rails (4.0.1)
@@ -39,15 +38,15 @@ GEM
execjs
coffee-script-source (1.7.0)
daemons (1.1.9)
- delayed_job (4.0.0)
- activesupport (>= 3.0, < 4.1)
- delayed_job_active_record (4.0.0)
- activerecord (>= 3.0, < 4.1)
+ delayed_job (4.0.1)
+ activesupport (>= 3.0, < 4.2)
+ delayed_job_active_record (4.0.1)
+ activerecord (>= 3.0, < 4.2)
delayed_job (>= 3.0, < 4.1)
erubis (2.7.0)
execjs (2.0.2)
hike (1.2.3)
- httparty (0.13.0)
+ httparty (0.13.1)
json (~> 1.8)
multi_xml (>= 0.5.2)
i18n (0.6.9)
@@ -83,16 +82,16 @@ GEM
activesupport (= 4.0.2)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
- rake (10.2.2)
+ rake (10.3.1)
rdoc (4.1.1)
json (~> 1.4)
ref (1.0.5)
- sass (3.2.18)
- sass-rails (4.0.2)
+ sass (3.2.19)
+ sass-rails (4.0.3)
railties (>= 4.0.0, < 5.0)
sass (~> 3.2.0)
sprockets (~> 2.8, <= 2.11.0)
- sprockets-rails (~> 2.0.0)
+ sprockets-rails (~> 2.0)
sdoc (0.4.0)
json (~> 1.8)
rdoc (~> 4.0, < 5.0)
@@ -112,13 +111,12 @@ GEM
libv8 (~> 3.16.14.0)
ref
thor (0.19.1)
- thread_safe (0.3.1)
- atomic (>= 1.1.7, < 2)
+ thread_safe (0.3.3)
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
- turbolinks (2.2.1)
+ turbolinks (2.2.2)
coffee-rails
tzinfo (0.3.39)
uglifier (2.5.0)
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
diff --git a/lib/pairing/PairingAlgorithm.rb b/lib/pairing/PairingAlgorithm.rb
index c3d7f7b..81e4df6 100644
--- a/lib/pairing/PairingAlgorithm.rb
+++ b/lib/pairing/PairingAlgorithm.rb
@@ -1,4 +1,4 @@
-module Leaguer
+module Pairing
class PairingAlgorithm
def self.pair(matches, players)
end
diff --git a/lib/scheduling/elimination.rb b/lib/scheduling/elimination.rb
index e718d54..e0f8d6a 100644
--- a/lib/scheduling/elimination.rb
+++ b/lib/scheduling/elimination.rb
@@ -8,6 +8,7 @@ module Scheduling
def tournament_stage
@tournament_stage
end
+
def tournament
self.tournament_stage.tournament
end
@@ -18,10 +19,14 @@ module Scheduling
for i in 1..num_matches
self.tournament_stage.matches.create(status: 0, submitted_peer_evaluations: 0)
end
+
match_num = num_matches-1
team_num = 0
+
+ self.tournament.players.shuffle
+
# for each grouping of min_players_per_team
- self.tournament.players.each_slice(min_players_per_team) do |team_members|
+ self.tournament.players.each_slice(self.tournament.min_players_per_team) do |team_members|
# if the match is full, move to the next match, otherwise move to the next team
if (team_num == min_teams_per_match)
match_num -= 1
diff --git a/lib/scoring/ScoringAlgorithm.rb b/lib/scoring/ScoringAlgorithm.rb
index 6277da8..f2afa6f 100644
--- a/lib/scoring/ScoringAlgorithm.rb
+++ b/lib/scoring/ScoringAlgorithm.rb
@@ -1,8 +1,6 @@
-module Leaguer
- module Scoring
- class ScoringAlgorithm
- def self.score(match, interface)
- end
+module Scoring
+ class ScoringAlgorithm
+ def self.score(match, interface)
end
end
-end \ No newline at end of file
+end