summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrewMurrell <amurrel@purdue.edu>2014-03-06 22:34:08 -0500
committerAndrewMurrell <amurrel@purdue.edu>2014-03-06 22:34:08 -0500
commit3ce5876375cbb3057ffc96e2886ba57cbd875dc9 (patch)
treee59dc46b293cdcd4ad8ad5b33bd4703f65adb0d9
parentce8b05ed8fa3466c727269daa47ba7df672fdca1 (diff)
parent70bae69d731afc5300ffa5b176732ebe27d0810f (diff)
Fixed some merge errors in show.html.erb
-rw-r--r--.gitignore1
-rw-r--r--app/controllers/tournaments_controller.rb18
-rw-r--r--app/models/team_match_pair.rb4
-rw-r--r--app/models/tournament.rb20
-rw-r--r--app/models/tournament_user_pair.rb4
-rw-r--r--app/models/user.rb4
-rw-r--r--app/models/user_team_pair.rb4
-rw-r--r--app/models/user_tournament_pair.rb4
-rw-r--r--app/views/tournaments/_form.html.erb8
-rw-r--r--app/views/tournaments/index.html.erb4
-rw-r--r--app/views/tournaments/index.json.jbuilder2
-rw-r--r--app/views/tournaments/join.html.erb2
-rw-r--r--app/views/tournaments/show.html.erb8
-rw-r--r--app/views/tournaments/show.json.jbuilder2
-rw-r--r--config/routes.rb4
-rw-r--r--db/migrate/20140307004031_create_user_team_pairs.rb10
-rw-r--r--db/migrate/20140307004036_create_user_tournament_pairs.rb10
-rw-r--r--db/migrate/20140307004041_create_team_match_pairs.rb10
-rw-r--r--db/migrate/20140307023418_create_servers.rb (renamed from db/migrate/20140307003926_create_servers.rb)0
-rw-r--r--db/migrate/20140307023423_create_matches.rb (renamed from db/migrate/20140307003931_create_matches.rb)0
-rw-r--r--db/migrate/20140307023428_create_teams.rb (renamed from db/migrate/20140307003703_create_teams.rb)0
-rw-r--r--db/migrate/20140307023433_create_alerts.rb (renamed from db/migrate/20140307003709_create_alerts.rb)0
-rw-r--r--db/migrate/20140307023438_create_pms.rb (renamed from db/migrate/20140307003714_create_pms.rb)0
-rw-r--r--db/migrate/20140307023443_create_tournaments.rb (renamed from db/migrate/20140307003719_create_tournaments.rb)0
-rw-r--r--db/migrate/20140307023448_create_games.rb (renamed from db/migrate/20140307003956_create_games.rb)0
-rw-r--r--db/migrate/20140307023453_create_users.rb (renamed from db/migrate/20140307004001_create_users.rb)0
-rw-r--r--db/migrate/20140307023459_create_sessions.rb (renamed from db/migrate/20140307004006_create_sessions.rb)0
-rw-r--r--db/migrate/20140307023504_create_server_settings.rb (renamed from db/migrate/20140307004011_create_server_settings.rb)0
-rw-r--r--db/migrate/20140307023509_create_tournament_options.rb (renamed from db/migrate/20140307004016_create_tournament_options.rb)0
-rw-r--r--db/migrate/20140307023514_create_game_options.rb (renamed from db/migrate/20140307004021_create_game_options.rb)0
-rw-r--r--db/migrate/20140307023519_create_scores.rb (renamed from db/migrate/20140307004027_create_scores.rb)0
-rw-r--r--db/migrate/20140307023524_create_tournament_players_join_table.rb8
-rw-r--r--db/migrate/20140307023529_create_tournament_hosts_join_table.rb8
-rw-r--r--db/migrate/20140307023534_create_user_team_join_table.rb8
-rw-r--r--db/migrate/20140307023538_create_match_team_join_table.rb8
-rw-r--r--db/migrate/20140307023557_add_hidden_attrs_to_user.rb (renamed from db/migrate/20140307004100_add_hidden_attrs_to_user.rb)0
-rw-r--r--db/schema.rb52
-rwxr-xr-xgenerate.sh10
-rw-r--r--test/fixtures/team_match_pairs.yml9
-rw-r--r--test/fixtures/tournament_user_pairs.yml9
-rw-r--r--test/fixtures/tournaments.yml4
-rw-r--r--test/fixtures/user_team_pairs.yml9
-rw-r--r--test/fixtures/user_tournament_pairs.yml9
-rw-r--r--test/models/team_match_pair_test.rb7
-rw-r--r--test/models/tournament_user_pair_test.rb7
-rw-r--r--test/models/user_team_pair_test.rb7
-rw-r--r--test/models/user_tournament_pair_test.rb7
47 files changed, 111 insertions, 170 deletions
diff --git a/.gitignore b/.gitignore
index 0e07518..830e151 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,4 @@ nohup.out
*~
*#
.#*
+.nfs*
diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb
index 9e6a6e6..3583ec3 100644
--- a/app/controllers/tournaments_controller.rb
+++ b/app/controllers/tournaments_controller.rb
@@ -38,9 +38,9 @@ class TournamentsController < ApplicationController
# POST /tournaments.json
def create
@tournament = Tournament.new(tournament_params)
-
respond_to do |format|
if @tournament.save
+ @tournament.hosts.push(current_user)
format.html { redirect_to @tournament, notice: 'Tournament was successfully created.' }
format.json { render action: 'show', status: :created, location: @tournament }
else
@@ -53,8 +53,7 @@ class TournamentsController < ApplicationController
# PATCH/PUT /tournaments/1
# PATCH/PUT /tournaments/1.json
def update
- require 'pp'
- pp params
+
if params[:update_action].nil?
check_perms
respond_to do |format|
@@ -77,8 +76,15 @@ class TournamentsController < ApplicationController
format.html { render action: 'permission_denied', status: :forbidden }
format.json { render json: "Permission denied", status: :forbidden }
end
- #when "open"
- # TODO
+ when "open"
+ respond_to do |format|
+ if @tournament.setup
+ format.html { render action: 'show', notice: 'You have joined this tournament.' }
+ format.json { head :no_content }
+ end
+ format.html { render action: 'permission_denied', status: :forbidden }
+ format.json { render json: "Permission denied", status: :forbidden }
+ end
#when "close"
# TODO
else
@@ -117,6 +123,6 @@ class TournamentsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def tournament_params
- params.require(:tournament).permit(:game, :game_id, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :status)
+ params.require(:tournament).permit(:game, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams)
end
end
diff --git a/app/models/team_match_pair.rb b/app/models/team_match_pair.rb
deleted file mode 100644
index 85f8eaa..0000000
--- a/app/models/team_match_pair.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-class TeamMatchPair < ActiveRecord::Base
- belongs_to :team
- belongs_to :match
-end
diff --git a/app/models/tournament.rb b/app/models/tournament.rb
index 26dec72..44b22f5 100644
--- a/app/models/tournament.rb
+++ b/app/models/tournament.rb
@@ -1,8 +1,8 @@
class Tournament < ActiveRecord::Base
belongs_to :game
has_many :matches
- has_many :user_tournament_pairs
- has_many :users, :through => :user_tournament_pairs
+ has_and_belongs_to_many :players, class_name: "User", association_foreign_key: "player_id", join_table: "players_tournaments"
+ has_and_belongs_to_many :hosts, class_name: "User", association_foreign_key: "host_id", join_table: "hosts_tournaments"
def open?
return true
@@ -16,7 +16,19 @@ class Tournament < ActiveRecord::Base
unless joinable_by?(user)
return false
end
- pair = UserTournamentPair.new(tournament: self, user: user)
- return pair.save
+ 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
diff --git a/app/models/tournament_user_pair.rb b/app/models/tournament_user_pair.rb
deleted file mode 100644
index eb4e9c5..0000000
--- a/app/models/tournament_user_pair.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-class TournamentUserPair < ActiveRecord::Base
- belongs_to :tournament
- belongs_to :user
-end
diff --git a/app/models/user.rb b/app/models/user.rb
index c3a9acb..fa07b60 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,6 +1,6 @@
class User < ActiveRecord::Base
- has_many :user_tournament_pairs
- has_many :tournaments, :through => :user_tournament_pairs
+ has_and_belongs_to_many :tournaments_played, class_name: "Tournament", foreign_key: "tournament_id", join_table: "players_tournaments"
+ has_and_belongs_to_many :tournaments_hosted, class_name: "Tournament", foreign_key: "tournament_id", join_table: "hosts_tournaments"
before_save { self.email = email.downcase }
before_save { self.user_name = user_name }
diff --git a/app/models/user_team_pair.rb b/app/models/user_team_pair.rb
deleted file mode 100644
index c55dc2e..0000000
--- a/app/models/user_team_pair.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-class UserTeamPair < ActiveRecord::Base
- belongs_to :user
- belongs_to :team
-end
diff --git a/app/models/user_tournament_pair.rb b/app/models/user_tournament_pair.rb
deleted file mode 100644
index b2676e5..0000000
--- a/app/models/user_tournament_pair.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-class UserTournamentPair < ActiveRecord::Base
- belongs_to :user
- belongs_to :tournament
-end
diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb
index c2c0ba7..d098cbb 100644
--- a/app/views/tournaments/_form.html.erb
+++ b/app/views/tournaments/_form.html.erb
@@ -16,6 +16,10 @@
<%= f.text_field :game_id %>
</div>
<div class="field">
+ <%= f.label :status %><br>
+ <%= f.number_field :status %>
+ </div>
+ <div class="field">
<%= f.label :min_players_per_team %><br>
<%= f.number_field :min_players_per_team %>
</div>
@@ -39,10 +43,6 @@
<%= f.label :randomized_teams %><br>
<%= f.check_box :randomized_teams %>
</div>
- <div class="field">
- <%= f.label :status %><br>
- <%= f.number_field :status %>
- </div>
<div class="actions">
<%= f.submit %>
</div>
diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb
index 80d68a3..452d939 100644
--- a/app/views/tournaments/index.html.erb
+++ b/app/views/tournaments/index.html.erb
@@ -5,13 +5,13 @@
<thead>
<tr>
<th>Game</th>
+ <th>Status</th>
<th>Min players per team</th>
<th>Max players per team</th>
<th>Min teams per match</th>
<th>Max teams per match</th>
<th>Set rounds</th>
<th>Randomized teams</th>
- <th>Status</th>
<th></th>
<th></th>
<th></th>
@@ -22,13 +22,13 @@
<% @tournaments.each do |tournament| %>
<tr>
<td><%= tournament.game %></td>
+ <td><%= tournament.status %></td>
<td><%= tournament.min_players_per_team %></td>
<td><%= tournament.max_players_per_team %></td>
<td><%= tournament.min_teams_per_match %></td>
<td><%= tournament.max_teams_per_match %></td>
<td><%= tournament.set_rounds %></td>
<td><%= tournament.randomized_teams %></td>
- <td><%= tournament.status %></td>
<td><%= link_to 'Show', tournament %></td>
<td><%= link_to 'Edit', edit_tournament_path(tournament) %></td>
<td><%= link_to 'Destroy', tournament, method: :delete, data: { confirm: 'Are you sure?' } %></td>
diff --git a/app/views/tournaments/index.json.jbuilder b/app/views/tournaments/index.json.jbuilder
index df8eee4..e95c6a7 100644
--- a/app/views/tournaments/index.json.jbuilder
+++ b/app/views/tournaments/index.json.jbuilder
@@ -1,4 +1,4 @@
json.array!(@tournaments) do |tournament|
- json.extract! tournament, :id, :game_id, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :status
+ json.extract! tournament, :id, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams
json.url tournament_url(tournament, format: :json)
end
diff --git a/app/views/tournaments/join.html.erb b/app/views/tournaments/join.html.erb
new file mode 100644
index 0000000..1d38d68
--- /dev/null
+++ b/app/views/tournaments/join.html.erb
@@ -0,0 +1,2 @@
+ <%= @user.name %>
+
diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb
index a04c852..c3a40e7 100644
--- a/app/views/tournaments/show.html.erb
+++ b/app/views/tournaments/show.html.erb
@@ -12,6 +12,11 @@
</p>
<p>
+ <strong>Status:</strong>
+ <%= @tournament.status %>
+</p>
+
+<p>
<strong>Min players per team:</strong>
<%= @tournament.min_players_per_team %>
</p>
@@ -54,4 +59,5 @@
<%= link_to 'Edit', edit_tournament_path(@tournament) %> |
<%= link_to 'Back', tournaments_path %>
-<% end %> \ No newline at end of file
+<% end %>
+
diff --git a/app/views/tournaments/show.json.jbuilder b/app/views/tournaments/show.json.jbuilder
index 7bedd4b..de2fbe0 100644
--- a/app/views/tournaments/show.json.jbuilder
+++ b/app/views/tournaments/show.json.jbuilder
@@ -1 +1 @@
-json.extract! @tournament, :id, :game_id, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :status, :created_at, :updated_at
+json.extract! @tournament, :id, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :created_at, :updated_at
diff --git a/config/routes.rb b/config/routes.rb
index a14c11a..5c5bece 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -11,13 +11,13 @@ Leaguer::Application.routes.draw do
resources :alerts
- resources :teams
+ resource :server, only: [:show, :edit, :update]
+ resources :teams
resources :tournaments do
resources :matches
end
- resource :server, only: [:show, :edit, :update]
root to: 'static#homepage'
diff --git a/db/migrate/20140307004031_create_user_team_pairs.rb b/db/migrate/20140307004031_create_user_team_pairs.rb
deleted file mode 100644
index 2c492ac..0000000
--- a/db/migrate/20140307004031_create_user_team_pairs.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class CreateUserTeamPairs < ActiveRecord::Migration
- def change
- create_table :user_team_pairs do |t|
- t.references :user, index: true
- t.references :team, index: true
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20140307004036_create_user_tournament_pairs.rb b/db/migrate/20140307004036_create_user_tournament_pairs.rb
deleted file mode 100644
index 9885b20..0000000
--- a/db/migrate/20140307004036_create_user_tournament_pairs.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class CreateUserTournamentPairs < ActiveRecord::Migration
- def change
- create_table :user_tournament_pairs do |t|
- t.references :user, index: true
- t.references :tournament, index: true
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20140307004041_create_team_match_pairs.rb b/db/migrate/20140307004041_create_team_match_pairs.rb
deleted file mode 100644
index 8fac07e..0000000
--- a/db/migrate/20140307004041_create_team_match_pairs.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class CreateTeamMatchPairs < ActiveRecord::Migration
- def change
- create_table :team_match_pairs do |t|
- t.references :team, index: true
- t.references :match, index: true
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20140307003926_create_servers.rb b/db/migrate/20140307023418_create_servers.rb
index f33241a..f33241a 100644
--- a/db/migrate/20140307003926_create_servers.rb
+++ b/db/migrate/20140307023418_create_servers.rb
diff --git a/db/migrate/20140307003931_create_matches.rb b/db/migrate/20140307023423_create_matches.rb
index 325863d..325863d 100644
--- a/db/migrate/20140307003931_create_matches.rb
+++ b/db/migrate/20140307023423_create_matches.rb
diff --git a/db/migrate/20140307003703_create_teams.rb b/db/migrate/20140307023428_create_teams.rb
index fdf9a68..fdf9a68 100644
--- a/db/migrate/20140307003703_create_teams.rb
+++ b/db/migrate/20140307023428_create_teams.rb
diff --git a/db/migrate/20140307003709_create_alerts.rb b/db/migrate/20140307023433_create_alerts.rb
index 68a8e10..68a8e10 100644
--- a/db/migrate/20140307003709_create_alerts.rb
+++ b/db/migrate/20140307023433_create_alerts.rb
diff --git a/db/migrate/20140307003714_create_pms.rb b/db/migrate/20140307023438_create_pms.rb
index 93bb5c6..93bb5c6 100644
--- a/db/migrate/20140307003714_create_pms.rb
+++ b/db/migrate/20140307023438_create_pms.rb
diff --git a/db/migrate/20140307003719_create_tournaments.rb b/db/migrate/20140307023443_create_tournaments.rb
index 545e603..545e603 100644
--- a/db/migrate/20140307003719_create_tournaments.rb
+++ b/db/migrate/20140307023443_create_tournaments.rb
diff --git a/db/migrate/20140307003956_create_games.rb b/db/migrate/20140307023448_create_games.rb
index 5e4f56f..5e4f56f 100644
--- a/db/migrate/20140307003956_create_games.rb
+++ b/db/migrate/20140307023448_create_games.rb
diff --git a/db/migrate/20140307004001_create_users.rb b/db/migrate/20140307023453_create_users.rb
index 8032870..8032870 100644
--- a/db/migrate/20140307004001_create_users.rb
+++ b/db/migrate/20140307023453_create_users.rb
diff --git a/db/migrate/20140307004006_create_sessions.rb b/db/migrate/20140307023459_create_sessions.rb
index fe25bf2..fe25bf2 100644
--- a/db/migrate/20140307004006_create_sessions.rb
+++ b/db/migrate/20140307023459_create_sessions.rb
diff --git a/db/migrate/20140307004011_create_server_settings.rb b/db/migrate/20140307023504_create_server_settings.rb
index dfdd91b..dfdd91b 100644
--- a/db/migrate/20140307004011_create_server_settings.rb
+++ b/db/migrate/20140307023504_create_server_settings.rb
diff --git a/db/migrate/20140307004016_create_tournament_options.rb b/db/migrate/20140307023509_create_tournament_options.rb
index 53b601c..53b601c 100644
--- a/db/migrate/20140307004016_create_tournament_options.rb
+++ b/db/migrate/20140307023509_create_tournament_options.rb
diff --git a/db/migrate/20140307004021_create_game_options.rb b/db/migrate/20140307023514_create_game_options.rb
index 2f62ef7..2f62ef7 100644
--- a/db/migrate/20140307004021_create_game_options.rb
+++ b/db/migrate/20140307023514_create_game_options.rb
diff --git a/db/migrate/20140307004027_create_scores.rb b/db/migrate/20140307023519_create_scores.rb
index 4ca0b0b..4ca0b0b 100644
--- a/db/migrate/20140307004027_create_scores.rb
+++ b/db/migrate/20140307023519_create_scores.rb
diff --git a/db/migrate/20140307023524_create_tournament_players_join_table.rb b/db/migrate/20140307023524_create_tournament_players_join_table.rb
new file mode 100644
index 0000000..be240e8
--- /dev/null
+++ b/db/migrate/20140307023524_create_tournament_players_join_table.rb
@@ -0,0 +1,8 @@
+class CreateTournamentPlayersJoinTable < ActiveRecord::Migration
+ def change
+ create_join_table :players, :tournaments do |t|
+ # t.index [:player_id, :tournament_id]
+ # t.index [:tournament_id, :player_id]
+ end
+ end
+end
diff --git a/db/migrate/20140307023529_create_tournament_hosts_join_table.rb b/db/migrate/20140307023529_create_tournament_hosts_join_table.rb
new file mode 100644
index 0000000..7521d89
--- /dev/null
+++ b/db/migrate/20140307023529_create_tournament_hosts_join_table.rb
@@ -0,0 +1,8 @@
+class CreateTournamentHostsJoinTable < ActiveRecord::Migration
+ def change
+ create_join_table :hosts, :tournaments do |t|
+ # t.index [:host_id, :tournament_id]
+ # t.index [:tournament_id, :host_id]
+ end
+ end
+end
diff --git a/db/migrate/20140307023534_create_user_team_join_table.rb b/db/migrate/20140307023534_create_user_team_join_table.rb
new file mode 100644
index 0000000..7b4d17f
--- /dev/null
+++ b/db/migrate/20140307023534_create_user_team_join_table.rb
@@ -0,0 +1,8 @@
+class CreateUserTeamJoinTable < ActiveRecord::Migration
+ def change
+ create_join_table :users, :matches do |t|
+ # t.index [:user_id, :match_id]
+ # t.index [:match_id, :user_id]
+ end
+ end
+end
diff --git a/db/migrate/20140307023538_create_match_team_join_table.rb b/db/migrate/20140307023538_create_match_team_join_table.rb
new file mode 100644
index 0000000..c2ed1b7
--- /dev/null
+++ b/db/migrate/20140307023538_create_match_team_join_table.rb
@@ -0,0 +1,8 @@
+class CreateMatchTeamJoinTable < ActiveRecord::Migration
+ def change
+ create_join_table :matches, :teams do |t|
+ # t.index [:match_id, :team_id]
+ # t.index [:team_id, :match_id]
+ end
+ end
+end
diff --git a/db/migrate/20140307004100_add_hidden_attrs_to_user.rb b/db/migrate/20140307023557_add_hidden_attrs_to_user.rb
index 2f1b0b2..2f1b0b2 100644
--- a/db/migrate/20140307004100_add_hidden_attrs_to_user.rb
+++ b/db/migrate/20140307023557_add_hidden_attrs_to_user.rb
diff --git a/db/schema.rb b/db/schema.rb
index cae1815..16789fb 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20140307004100) do
+ActiveRecord::Schema.define(version: 20140307023557) do
create_table "alerts", force: true do |t|
t.integer "author_id"
@@ -42,6 +42,11 @@ ActiveRecord::Schema.define(version: 20140307004100) do
t.datetime "updated_at"
end
+ create_table "hosts_tournaments", id: false, force: true do |t|
+ t.integer "host_id", null: false
+ t.integer "tournament_id", null: false
+ end
+
create_table "matches", force: true do |t|
t.integer "tournament_id"
t.string "name"
@@ -51,6 +56,21 @@ ActiveRecord::Schema.define(version: 20140307004100) do
add_index "matches", ["tournament_id"], name: "index_matches_on_tournament_id"
+ create_table "matches_teams", id: false, force: true do |t|
+ t.integer "match_id", null: false
+ t.integer "team_id", null: false
+ end
+
+ create_table "matches_users", id: false, force: true do |t|
+ t.integer "user_id", null: false
+ t.integer "match_id", null: false
+ end
+
+ create_table "players_tournaments", id: false, force: true do |t|
+ t.integer "player_id", null: false
+ t.integer "tournament_id", null: false
+ end
+
create_table "pms", force: true do |t|
t.integer "author_id"
t.integer "recipient_id"
@@ -91,16 +111,6 @@ ActiveRecord::Schema.define(version: 20140307004100) do
add_index "sessions", ["user_id"], name: "index_sessions_on_user_id"
- create_table "team_match_pairs", force: true do |t|
- t.integer "team_id"
- t.integer "match_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- add_index "team_match_pairs", ["match_id"], name: "index_team_match_pairs_on_match_id"
- add_index "team_match_pairs", ["team_id"], name: "index_team_match_pairs_on_team_id"
-
create_table "teams", force: true do |t|
t.integer "match_id"
t.datetime "created_at"
@@ -135,26 +145,6 @@ ActiveRecord::Schema.define(version: 20140307004100) do
add_index "tournaments", ["game_id"], name: "index_tournaments_on_game_id"
- create_table "user_team_pairs", force: true do |t|
- t.integer "user_id"
- t.integer "team_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- add_index "user_team_pairs", ["team_id"], name: "index_user_team_pairs_on_team_id"
- add_index "user_team_pairs", ["user_id"], name: "index_user_team_pairs_on_user_id"
-
- create_table "user_tournament_pairs", force: true do |t|
- t.integer "user_id"
- t.integer "tournament_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- add_index "user_tournament_pairs", ["tournament_id"], name: "index_user_tournament_pairs_on_tournament_id"
- add_index "user_tournament_pairs", ["user_id"], name: "index_user_tournament_pairs_on_user_id"
-
create_table "users", force: true do |t|
t.string "name"
t.string "email"
diff --git a/generate.sh b/generate.sh
index db9e84b..03225e7 100755
--- a/generate.sh
+++ b/generate.sh
@@ -39,10 +39,12 @@ bundle exec rails generate model server_settings $NOTEST
bundle exec rails generate model tournament_option tournament:references vartype:integer name:string value:text $NOTEST
bundle exec rails generate model game_option vartype:integer name:string default:text $NOTEST
bundle exec rails generate model score user:references match:references value:integer $NOTEST
-# Bridge Models
-bundle exec rails generate model user_team_pair user:references team:references $NOTEST
-bundle exec rails generate model user_tournament_pair user:references tournament:references
-bundle exec rails generate model team_match_pair team:references match:references $NOTEST
+
+# Join tables
+bundle exec rails generate migration CreateTournamentPlayersJoinTable players tournaments
+bundle exec rails generate migration CreateTournamentHostsJoinTable hosts tournaments
+bundle exec rails generate migration CreateUserTeamJoinTable users matches
+bundle exec rails generate migration CreateMatchTeamJoinTable matches teams
# Just controllers
bundle exec rails generate controller search $NOTEST
diff --git a/test/fixtures/team_match_pairs.yml b/test/fixtures/team_match_pairs.yml
deleted file mode 100644
index 5f9cf2f..0000000
--- a/test/fixtures/team_match_pairs.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
-
-one:
- team_id:
- match_id:
-
-two:
- team_id:
- match_id:
diff --git a/test/fixtures/tournament_user_pairs.yml b/test/fixtures/tournament_user_pairs.yml
deleted file mode 100644
index dbc4a88..0000000
--- a/test/fixtures/tournament_user_pairs.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
-
-one:
- tournament_id:
- user_id:
-
-two:
- tournament_id:
- user_id:
diff --git a/test/fixtures/tournaments.yml b/test/fixtures/tournaments.yml
index c58a1ed..27c92f9 100644
--- a/test/fixtures/tournaments.yml
+++ b/test/fixtures/tournaments.yml
@@ -2,20 +2,20 @@
one:
game_id:
+ status: 1
min_players_per_team: 1
max_players_per_team: 1
min_teams_per_match: 1
max_teams_per_match: 1
set_rounds: 1
randomized_teams: false
- status: 1
two:
game_id:
+ status: 1
min_players_per_team: 1
max_players_per_team: 1
min_teams_per_match: 1
max_teams_per_match: 1
set_rounds: 1
randomized_teams: false
- status: 1
diff --git a/test/fixtures/user_team_pairs.yml b/test/fixtures/user_team_pairs.yml
deleted file mode 100644
index a76036f..0000000
--- a/test/fixtures/user_team_pairs.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
-
-one:
- user_id:
- team_id:
-
-two:
- user_id:
- team_id:
diff --git a/test/fixtures/user_tournament_pairs.yml b/test/fixtures/user_tournament_pairs.yml
deleted file mode 100644
index 974ee71..0000000
--- a/test/fixtures/user_tournament_pairs.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
-
-one:
- user_id:
- tournament_id:
-
-two:
- user_id:
- tournament_id:
diff --git a/test/models/team_match_pair_test.rb b/test/models/team_match_pair_test.rb
deleted file mode 100644
index c250b3c..0000000
--- a/test/models/team_match_pair_test.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require 'test_helper'
-
-class TeamMatchPairTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
-end
diff --git a/test/models/tournament_user_pair_test.rb b/test/models/tournament_user_pair_test.rb
deleted file mode 100644
index c8d1789..0000000
--- a/test/models/tournament_user_pair_test.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require 'test_helper'
-
-class TournamentUserPairTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
-end
diff --git a/test/models/user_team_pair_test.rb b/test/models/user_team_pair_test.rb
deleted file mode 100644
index 55f5c58..0000000
--- a/test/models/user_team_pair_test.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require 'test_helper'
-
-class UserTeamPairTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
-end
diff --git a/test/models/user_tournament_pair_test.rb b/test/models/user_tournament_pair_test.rb
deleted file mode 100644
index 6167ff6..0000000
--- a/test/models/user_tournament_pair_test.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require 'test_helper'
-
-class UserTournamentPairTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
-end