From aedb959b027e10290a344495b28047437c28e1aa Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Mon, 28 Apr 2014 00:37:13 -0400 Subject: Fixing Errors in lib and hooks into lib --- app/models/tournament_stage.rb | 2 +- lib/scheduling/round_robin.rb | 6 +++--- 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 -- cgit v1.2.3