summaryrefslogtreecommitdiff
path: root/lib/scheduling/round_robin.rb
diff options
context:
space:
mode:
authornfoy <nfoy@purdue.edu>2014-04-27 19:12:07 -0400
committernfoy <nfoy@purdue.edu>2014-04-27 19:12:07 -0400
commit95542d38ddae5700e7fa35c166260a51ce17e46a (patch)
tree3ed1b9fcb793a426901586367dc5212819e9bff5 /lib/scheduling/round_robin.rb
parent07dbbeb404dedcf9733262ae2ce9cdddc086bb0e (diff)
parent8b1e26bf00c7e536def47ae4ef3441192f154aa8 (diff)
Merge branch 'master' of https://github.com/LukeShu/leaguer
Diffstat (limited to 'lib/scheduling/round_robin.rb')
-rw-r--r--lib/scheduling/round_robin.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/scheduling/round_robin.rb b/lib/scheduling/round_robin.rb
index 7a9e257..1d9ac0d 100644
--- a/lib/scheduling/round_robin.rb
+++ b/lib/scheduling/round_robin.rb
@@ -7,11 +7,15 @@ module Scheduling
end
def create_matches
+ #number of teams*number of teams per match = number of matches per round
num_teams = (tournament.players.count/tournament.min_players_per_team).floor
- num_matches = Float(num_teams/2)*(num_teams-1)
- for i in 1..num_matches
+ @matches_per_round = num_teams * tournament.min_teams_per_match
+
+ @matches_per_round.each do |match|
tournament_stage.matches.create(status: 0, submitted_peer_evaluations: 0)
end
+
+ tournament_stage.seeding.seed_matches(tournament_stage)
end
def finish_match(match)