summaryrefslogtreecommitdiff
path: root/lib/scheduling
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 /lib/scheduling
parent42aa0fe7fdfc51f79cda90c4d71621a797995a6c (diff)
Added Pairing Algorithms
Diffstat (limited to 'lib/scheduling')
-rw-r--r--lib/scheduling/elimination.rb7
1 files changed, 6 insertions, 1 deletions
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