summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrewMurrell <amurrel@purdue.edu>2014-04-27 18:25:04 -0400
committerAndrewMurrell <amurrel@purdue.edu>2014-04-27 18:25:04 -0400
commitc16c1b2928d0156fc00617a6abd81f4714045e5e (patch)
tree963a38a2b638f0d6ccf4cb0efe6a6e86e5728b60 /lib
parentbd1699969017c8c8f056808ba33e906426962754 (diff)
Updated Seeing and Round Robin scheduling.
Diffstat (limited to 'lib')
-rw-r--r--lib/scheduling/round_robin.rb8
-rw-r--r--lib/seeding/README.md5
-rw-r--r--lib/seeding/early_bird_seeding.rb2
-rw-r--r--lib/seeding/fair_ranked_seeding.rb2
-rw-r--r--lib/seeding/random_seeding.rb2
5 files changed, 12 insertions, 7 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)
diff --git a/lib/seeding/README.md b/lib/seeding/README.md
index 67fc19b..596adea 100644
--- a/lib/seeding/README.md
+++ b/lib/seeding/README.md
@@ -1,4 +1,5 @@
Files in this directory should implement the following interface:
-- seed_matches(tournament)
- take the matches of a tournament and the players in a tournament, assign players to teams, and teams to matches (all must exist) \ No newline at end of file
+- `seed(tournament_stage)`
+ take a tournament stage, assign players to teams and teams to
+ matches (matches must exist) \ No newline at end of file
diff --git a/lib/seeding/early_bird_seeding.rb b/lib/seeding/early_bird_seeding.rb
index 30e15fc..f3fc6f9 100644
--- a/lib/seeding/early_bird_seeding.rb
+++ b/lib/seeding/early_bird_seeding.rb
@@ -1,6 +1,6 @@
module Seeding
class EarlyBirdSeeding
- def seed_matches(tournament)
+ def seed(tournament_stage)
matches = tournament.current_stage.matches
match = matches.first
match_num = 0
diff --git a/lib/seeding/fair_ranked_seeding.rb b/lib/seeding/fair_ranked_seeding.rb
index 4eb8c26..22c245e 100644
--- a/lib/seeding/fair_ranked_seeding.rb
+++ b/lib/seeding/fair_ranked_seeding.rb
@@ -1,6 +1,6 @@
module Seeding
class FairRankedSeeding
- def seed_matches(tournament)
+ def seed(tournament_stage)
matches = tournament.current_stage.matches
match = matches.first
match_num = 0
diff --git a/lib/seeding/random_seeding.rb b/lib/seeding/random_seeding.rb
index ec39e61..bc332ef 100644
--- a/lib/seeding/random_seeding.rb
+++ b/lib/seeding/random_seeding.rb
@@ -1,6 +1,6 @@
module Seeding
class RandomSeeding
- def seed_matches(tournament)
+ def seed(tournament_stage)
matches = tournament.current_stage.matches
match = matches.first
match_num = 0