summaryrefslogtreecommitdiff
path: root/app/models/tournament.rb
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-03-06 22:17:36 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-03-06 22:17:36 -0500
commit5f2247dd1e701a91fb0359bf7265bdadd5486a60 (patch)
tree8966f53e304731faf26b19230439f831b215d3f1 /app/models/tournament.rb
parent4a91128f6fe20d95b6692abaa5e6c4dc92418b46 (diff)
parent2bfc17c39f9b8b5ea71d36d2d5f041295f24192f (diff)
Merge branch 'master' of github.com:LukeShu/leaguer
Conflicts: config/routes.rb
Diffstat (limited to 'app/models/tournament.rb')
-rw-r--r--app/models/tournament.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/tournament.rb b/app/models/tournament.rb
index aa22afa..44b22f5 100644
--- a/app/models/tournament.rb
+++ b/app/models/tournament.rb
@@ -18,4 +18,17 @@ class Tournament < ActiveRecord::Base
end
players<<user
end
+
+ def setup
+ num_teams = (self.users.count/self.players_per_team).floor
+ num_matches = num_teams - 1
+ for i in 0..num_matches
+ self.matches.create(name: "Match #{i}")
+ end
+ #self.players.each_slice(num_teams) do |team_players|
+ # Team.new(users: team_players)
+ #end
+ end
+
+
end