summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrewMurrell <amurrel@purdue.edu>2014-04-28 00:37:13 -0400
committerAndrewMurrell <amurrel@purdue.edu>2014-04-28 00:37:13 -0400
commitaedb959b027e10290a344495b28047437c28e1aa (patch)
tree0f1c605f91f77c3300a9a9929e2ac8fe48805147
parente5f603c8c463e09fee5931d7e00e94e14b819347 (diff)
Fixing Errors in lib and hooks into lib
-rw-r--r--app/models/tournament_stage.rb2
-rw-r--r--lib/scheduling/round_robin.rb6
2 files changed, 4 insertions, 4 deletions
diff --git a/app/models/tournament_stage.rb b/app/models/tournament_stage.rb
index 9352137..caf5a8a 100644
--- a/app/models/tournament_stage.rb
+++ b/app/models/tournament_stage.rb
@@ -40,6 +40,6 @@ class TournamentStage < ActiveRecord::Base
end
def seeding
- @seeding ||= "Seeding::#{self.seeding_method.camelcase}".constantize.new(self)
+ @seeding ||= "Seeding::#{self.seeding_method.camelcase}".constantize
end
end
diff --git a/lib/scheduling/round_robin.rb b/lib/scheduling/round_robin.rb
index 0cbddc1..f2e4144 100644
--- a/lib/scheduling/round_robin.rb
+++ b/lib/scheduling/round_robin.rb
@@ -9,7 +9,7 @@ module Scheduling
def create_matches
# => find the number of matches and teams to create
@num_teams = (tournament.players.count/tournament.min_players_per_team).floor
- @matches_per_round = num_teams * tournament.min_teams_per_match
+ @matches_per_round = @num_teams * tournament.min_teams_per_match
# => initialize data and status members
@team_pairs ||= {}
@@ -18,13 +18,13 @@ module Scheduling
end
# => Create new matches
- @matches_per_round.each do |match|
+ @matches_per_round.times do
tournament_stage.matches.create(status: 0, submitted_peer_evaluations: 0)
end
# => seed the first time
if @team_pairs.empty?
- tournament_stage.seeding.seed_matches(tournament_stage)
+ tournament_stage.seeding.seed(tournament_stage)
tournament_stage.matches.each {|match| match.teams.each {|team| @team_pairs += team}}
else
# => Reorder the list of teams