diff options
author | nfoy <nfoy@purdue.edu> | 2014-04-06 19:54:48 -0400 |
---|---|---|
committer | nfoy <nfoy@purdue.edu> | 2014-04-06 19:54:48 -0400 |
commit | e7bf049624246a1248d09c571db31ef26260ae08 (patch) | |
tree | fe22ea682512de877630232f71e3c4b5b609096e /app/models | |
parent | 2fd131ea6c6a1810d27941d85bcf5a5eb2d8669f (diff) | |
parent | f85943114dba527a1f87abb03229553472f57c0c (diff) |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/tournament.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/tournament.rb b/app/models/tournament.rb index e408cfe..0029de7 100644 --- a/app/models/tournament.rb +++ b/app/models/tournament.rb @@ -31,7 +31,7 @@ class Tournament < ActiveRecord::Base for i in 1..num_matches self.matches.create(name: "Match #{i}", status: 0) end - match_num = 0 + match_num = num_matches-1 team_num = 0 #for each grouping of min_players_per_team self.players.each_slice(min_players_per_team) do |players| @@ -39,7 +39,7 @@ class Tournament < ActiveRecord::Base self.matches[match_num].teams.push(Team.create(users: players)) #if the match is full, move to the next match, otherwise move to the next team if (team_num != 0 and team_num % max_teams_per_match == 0) - match_num += 1 + match_num -= 1 team_num = 0 else team_num += 1 |