summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-22 15:53:32 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-22 15:53:32 -0400
commitc927cd7c043d982f8ffb51c8a78288d88d825d82 (patch)
tree600b2ad18f8faa3ff5d31bfe6ac61edf59fb8bc9
parentd36c548ca756f8371c08991287e3625d031cf8b3 (diff)
run ./generate.sh
-rw-r--r--app/controllers/matches_controller.rb2
-rw-r--r--app/controllers/teams_controller.rb2
-rw-r--r--app/models/team.rb1
-rw-r--r--app/views/matches/_form.html.erb6
-rw-r--r--app/views/matches/index.html.erb2
-rw-r--r--app/views/matches/index.json.jbuilder2
-rw-r--r--app/views/matches/show.html.erb5
-rw-r--r--app/views/matches/show.json.jbuilder2
-rw-r--r--app/views/teams/_form.html.erb4
-rw-r--r--app/views/teams/index.html.erb2
-rw-r--r--app/views/teams/index.json.jbuilder2
-rw-r--r--app/views/teams/show.html.erb5
-rw-r--r--app/views/teams/show.json.jbuilder2
-rw-r--r--db/migrate/20140422155038_create_simple_captcha_data.rb (renamed from db/migrate/20140422021622_create_simple_captcha_data.rb)0
-rw-r--r--db/migrate/20140422195042_create_delayed_jobs.rb (renamed from db/migrate/20140422061625_create_delayed_jobs.rb)0
-rw-r--r--db/migrate/20140422195045_create_servers.rb (renamed from db/migrate/20140422061628_create_servers.rb)0
-rw-r--r--db/migrate/20140422195049_create_matches.rb (renamed from db/migrate/20140422061631_create_matches.rb)3
-rw-r--r--db/migrate/20140422195052_create_teams.rb (renamed from db/migrate/20140422061633_create_teams.rb)1
-rw-r--r--db/migrate/20140422195056_create_alerts.rb (renamed from db/migrate/20140422061636_create_alerts.rb)0
-rw-r--r--db/migrate/20140422195059_create_pms.rb (renamed from db/migrate/20140422061639_create_pms.rb)0
-rw-r--r--db/migrate/20140422195103_create_tournaments.rb (renamed from db/migrate/20140422061642_create_tournaments.rb)0
-rw-r--r--db/migrate/20140422195107_create_games.rb (renamed from db/migrate/20140422061645_create_games.rb)0
-rw-r--r--db/migrate/20140422195110_create_users.rb (renamed from db/migrate/20140422061648_create_users.rb)0
-rw-r--r--db/migrate/20140422195114_create_sessions.rb (renamed from db/migrate/20140422061651_create_sessions.rb)0
-rw-r--r--db/migrate/20140422195118_create_brackets.rb (renamed from db/migrate/20140422061654_create_brackets.rb)0
-rw-r--r--db/migrate/20140422195121_create_game_settings.rb (renamed from db/migrate/20140422061657_create_game_settings.rb)0
-rw-r--r--db/migrate/20140422195125_create_tournament_settings.rb (renamed from db/migrate/20140422061700_create_tournament_settings.rb)0
-rw-r--r--db/migrate/20140422195128_create_tournament_stages.rb (renamed from db/migrate/20140422061703_create_tournament_stages.rb)0
-rw-r--r--db/migrate/20140422195132_create_statistics.rb (renamed from db/migrate/20140422061706_create_statistics.rb)0
-rw-r--r--db/migrate/20140422195135_create_remote_usernames.rb (renamed from db/migrate/20140422061709_create_remote_usernames.rb)0
-rw-r--r--db/migrate/20140422195139_create_bracket_matches.rb (renamed from db/migrate/20140422061712_create_bracket_matches.rb)0
-rw-r--r--db/migrate/20140422195143_create_api_requests.rb (renamed from db/migrate/20140422061715_create_api_requests.rb)0
-rw-r--r--db/migrate/20140422195146_create_tournament_players_join_table.rb (renamed from db/migrate/20140422061718_create_tournament_players_join_table.rb)0
-rw-r--r--db/migrate/20140422195150_create_tournament_hosts_join_table.rb (renamed from db/migrate/20140422061721_create_tournament_hosts_join_table.rb)0
-rw-r--r--db/migrate/20140422195153_create_team_user_join_table.rb (renamed from db/migrate/20140422061724_create_team_user_join_table.rb)0
-rw-r--r--db/migrate/20140422195157_create_match_team_join_table.rb (renamed from db/migrate/20140422061727_create_match_team_join_table.rb)0
-rw-r--r--db/migrate/20140422195211_add_hidden_attrs_to_user.rb (renamed from db/migrate/20140422061739_add_hidden_attrs_to_user.rb)0
-rw-r--r--db/schema.rb8
-rw-r--r--test/controllers/matches_controller_test.rb4
-rw-r--r--test/controllers/teams_controller_test.rb4
-rw-r--r--test/fixtures/matches.yml6
-rw-r--r--test/fixtures/teams.yml14
42 files changed, 25 insertions, 52 deletions
diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb
index b19faf4..b1162ef 100644
--- a/app/controllers/matches_controller.rb
+++ b/app/controllers/matches_controller.rb
@@ -69,6 +69,6 @@ class MatchesController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def match_params
- params.require(:match).permit(:status, :tournament_stage_id, :name, :winner_id, :remote_id, :submitted_peer_evaluations)
+ params.require(:match).permit(:status, :tournament_stage_id, :winner_id, :remote_id, :submitted_peer_evaluations)
end
end
diff --git a/app/controllers/teams_controller.rb b/app/controllers/teams_controller.rb
index 05e7a12..57b3d91 100644
--- a/app/controllers/teams_controller.rb
+++ b/app/controllers/teams_controller.rb
@@ -69,6 +69,6 @@ class TeamsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def team_params
- params.require(:team).permit(:match_id)
+ params[:team]
end
end
diff --git a/app/models/team.rb b/app/models/team.rb
index 8d89f51..fa7ba9e 100644
--- a/app/models/team.rb
+++ b/app/models/team.rb
@@ -1,3 +1,2 @@
class Team < ActiveRecord::Base
- belongs_to :match
end
diff --git a/app/views/matches/_form.html.erb b/app/views/matches/_form.html.erb
index 65069d1..9e09fd8 100644
--- a/app/views/matches/_form.html.erb
+++ b/app/views/matches/_form.html.erb
@@ -20,16 +20,12 @@
<%= f.text_field :tournament_stage_id %>
</div>
<div class="field">
- <%= f.label :name %><br>
- <%= f.text_field :name %>
- </div>
- <div class="field">
<%= f.label :winner_id %><br>
<%= f.text_field :winner_id %>
</div>
<div class="field">
<%= f.label :remote_id %><br>
- <%= f.text_field :remote_id %>
+ <%= f.text_area :remote_id %>
</div>
<div class="field">
<%= f.label :submitted_peer_evaluations %><br>
diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb
index 414d57d..766c3e8 100644
--- a/app/views/matches/index.html.erb
+++ b/app/views/matches/index.html.erb
@@ -5,7 +5,6 @@
<tr>
<th>Status</th>
<th>Tournament stage</th>
- <th>Name</th>
<th>Winner</th>
<th>Remote</th>
<th>Submitted peer evaluations</th>
@@ -20,7 +19,6 @@
<tr>
<td><%= match.status %></td>
<td><%= match.tournament_stage %></td>
- <td><%= match.name %></td>
<td><%= match.winner %></td>
<td><%= match.remote_id %></td>
<td><%= match.submitted_peer_evaluations %></td>
diff --git a/app/views/matches/index.json.jbuilder b/app/views/matches/index.json.jbuilder
index f2499ac..bef149d 100644
--- a/app/views/matches/index.json.jbuilder
+++ b/app/views/matches/index.json.jbuilder
@@ -1,4 +1,4 @@
json.array!(@matches) do |match|
- json.extract! match, :id, :status, :tournament_stage_id, :name, :winner_id, :remote_id, :submitted_peer_evaluations
+ json.extract! match, :id, :status, :tournament_stage_id, :winner_id, :remote_id, :submitted_peer_evaluations
json.url match_url(match, format: :json)
end
diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb
index 3356e28..8384ff2 100644
--- a/app/views/matches/show.html.erb
+++ b/app/views/matches/show.html.erb
@@ -11,11 +11,6 @@
</p>
<p>
- <strong>Name:</strong>
- <%= @match.name %>
-</p>
-
-<p>
<strong>Winner:</strong>
<%= @match.winner %>
</p>
diff --git a/app/views/matches/show.json.jbuilder b/app/views/matches/show.json.jbuilder
index 5b543ea..145f069 100644
--- a/app/views/matches/show.json.jbuilder
+++ b/app/views/matches/show.json.jbuilder
@@ -1 +1 @@
-json.extract! @match, :id, :status, :tournament_stage_id, :name, :winner_id, :remote_id, :submitted_peer_evaluations, :created_at, :updated_at
+json.extract! @match, :id, :status, :tournament_stage_id, :winner_id, :remote_id, :submitted_peer_evaluations, :created_at, :updated_at
diff --git a/app/views/teams/_form.html.erb b/app/views/teams/_form.html.erb
index cdd4299..fd10129 100644
--- a/app/views/teams/_form.html.erb
+++ b/app/views/teams/_form.html.erb
@@ -11,10 +11,6 @@
</div>
<% end %>
- <div class="field">
- <%= f.label :match_id %><br>
- <%= f.text_field :match_id %>
- </div>
<div class="actions">
<%= f.submit %>
</div>
diff --git a/app/views/teams/index.html.erb b/app/views/teams/index.html.erb
index 6a3188d..b077e10 100644
--- a/app/views/teams/index.html.erb
+++ b/app/views/teams/index.html.erb
@@ -3,7 +3,6 @@
<table>
<thead>
<tr>
- <th>Match</th>
<th></th>
<th></th>
<th></th>
@@ -13,7 +12,6 @@
<tbody>
<% @teams.each do |team| %>
<tr>
- <td><%= team.match %></td>
<td><%= link_to 'Show', team %></td>
<td><%= link_to 'Edit', edit_team_path(team) %></td>
<td><%= link_to 'Destroy', team, method: :delete, data: { confirm: 'Are you sure?' } %></td>
diff --git a/app/views/teams/index.json.jbuilder b/app/views/teams/index.json.jbuilder
index ca0ec8b..b29428b 100644
--- a/app/views/teams/index.json.jbuilder
+++ b/app/views/teams/index.json.jbuilder
@@ -1,4 +1,4 @@
json.array!(@teams) do |team|
- json.extract! team, :id, :match_id
+ json.extract! team, :id
json.url team_url(team, format: :json)
end
diff --git a/app/views/teams/show.html.erb b/app/views/teams/show.html.erb
index e41692a..5b18d33 100644
--- a/app/views/teams/show.html.erb
+++ b/app/views/teams/show.html.erb
@@ -1,9 +1,4 @@
<p id="notice"><%= notice %></p>
-<p>
- <strong>Match:</strong>
- <%= @team.match %>
-</p>
-
<%= link_to 'Edit', edit_team_path(@team) %> |
<%= link_to 'Back', teams_path %>
diff --git a/app/views/teams/show.json.jbuilder b/app/views/teams/show.json.jbuilder
index 8a85dcc..1538019 100644
--- a/app/views/teams/show.json.jbuilder
+++ b/app/views/teams/show.json.jbuilder
@@ -1 +1 @@
-json.extract! @team, :id, :match_id, :created_at, :updated_at
+json.extract! @team, :id, :created_at, :updated_at
diff --git a/db/migrate/20140422021622_create_simple_captcha_data.rb b/db/migrate/20140422155038_create_simple_captcha_data.rb
index 4573b20..4573b20 100644
--- a/db/migrate/20140422021622_create_simple_captcha_data.rb
+++ b/db/migrate/20140422155038_create_simple_captcha_data.rb
diff --git a/db/migrate/20140422061625_create_delayed_jobs.rb b/db/migrate/20140422195042_create_delayed_jobs.rb
index ec0dd93..ec0dd93 100644
--- a/db/migrate/20140422061625_create_delayed_jobs.rb
+++ b/db/migrate/20140422195042_create_delayed_jobs.rb
diff --git a/db/migrate/20140422061628_create_servers.rb b/db/migrate/20140422195045_create_servers.rb
index fbe1b02..fbe1b02 100644
--- a/db/migrate/20140422061628_create_servers.rb
+++ b/db/migrate/20140422195045_create_servers.rb
diff --git a/db/migrate/20140422061631_create_matches.rb b/db/migrate/20140422195049_create_matches.rb
index 3786d52..bac92d1 100644
--- a/db/migrate/20140422061631_create_matches.rb
+++ b/db/migrate/20140422195049_create_matches.rb
@@ -3,9 +3,8 @@ class CreateMatches < ActiveRecord::Migration
create_table :matches do |t|
t.integer :status
t.references :tournament_stage, index: true
- t.string :name
t.references :winner, index: true
- t.string :remote_id
+ t.text :remote_id
t.integer :submitted_peer_evaluations
t.timestamps
diff --git a/db/migrate/20140422061633_create_teams.rb b/db/migrate/20140422195052_create_teams.rb
index fdf9a68..dd8397d 100644
--- a/db/migrate/20140422061633_create_teams.rb
+++ b/db/migrate/20140422195052_create_teams.rb
@@ -1,7 +1,6 @@
class CreateTeams < ActiveRecord::Migration
def change
create_table :teams do |t|
- t.references :match, index: true
t.timestamps
end
diff --git a/db/migrate/20140422061636_create_alerts.rb b/db/migrate/20140422195056_create_alerts.rb
index 68a8e10..68a8e10 100644
--- a/db/migrate/20140422061636_create_alerts.rb
+++ b/db/migrate/20140422195056_create_alerts.rb
diff --git a/db/migrate/20140422061639_create_pms.rb b/db/migrate/20140422195059_create_pms.rb
index 93bb5c6..93bb5c6 100644
--- a/db/migrate/20140422061639_create_pms.rb
+++ b/db/migrate/20140422195059_create_pms.rb
diff --git a/db/migrate/20140422061642_create_tournaments.rb b/db/migrate/20140422195103_create_tournaments.rb
index 716871f..716871f 100644
--- a/db/migrate/20140422061642_create_tournaments.rb
+++ b/db/migrate/20140422195103_create_tournaments.rb
diff --git a/db/migrate/20140422061645_create_games.rb b/db/migrate/20140422195107_create_games.rb
index 46ed30d..46ed30d 100644
--- a/db/migrate/20140422061645_create_games.rb
+++ b/db/migrate/20140422195107_create_games.rb
diff --git a/db/migrate/20140422061648_create_users.rb b/db/migrate/20140422195110_create_users.rb
index 8032870..8032870 100644
--- a/db/migrate/20140422061648_create_users.rb
+++ b/db/migrate/20140422195110_create_users.rb
diff --git a/db/migrate/20140422061651_create_sessions.rb b/db/migrate/20140422195114_create_sessions.rb
index f667f1e..f667f1e 100644
--- a/db/migrate/20140422061651_create_sessions.rb
+++ b/db/migrate/20140422195114_create_sessions.rb
diff --git a/db/migrate/20140422061654_create_brackets.rb b/db/migrate/20140422195118_create_brackets.rb
index 8813bf2..8813bf2 100644
--- a/db/migrate/20140422061654_create_brackets.rb
+++ b/db/migrate/20140422195118_create_brackets.rb
diff --git a/db/migrate/20140422061657_create_game_settings.rb b/db/migrate/20140422195121_create_game_settings.rb
index 06fb72e..06fb72e 100644
--- a/db/migrate/20140422061657_create_game_settings.rb
+++ b/db/migrate/20140422195121_create_game_settings.rb
diff --git a/db/migrate/20140422061700_create_tournament_settings.rb b/db/migrate/20140422195125_create_tournament_settings.rb
index e56697f..e56697f 100644
--- a/db/migrate/20140422061700_create_tournament_settings.rb
+++ b/db/migrate/20140422195125_create_tournament_settings.rb
diff --git a/db/migrate/20140422061703_create_tournament_stages.rb b/db/migrate/20140422195128_create_tournament_stages.rb
index e3668cb..e3668cb 100644
--- a/db/migrate/20140422061703_create_tournament_stages.rb
+++ b/db/migrate/20140422195128_create_tournament_stages.rb
diff --git a/db/migrate/20140422061706_create_statistics.rb b/db/migrate/20140422195132_create_statistics.rb
index cc2e97d..cc2e97d 100644
--- a/db/migrate/20140422061706_create_statistics.rb
+++ b/db/migrate/20140422195132_create_statistics.rb
diff --git a/db/migrate/20140422061709_create_remote_usernames.rb b/db/migrate/20140422195135_create_remote_usernames.rb
index e265985..e265985 100644
--- a/db/migrate/20140422061709_create_remote_usernames.rb
+++ b/db/migrate/20140422195135_create_remote_usernames.rb
diff --git a/db/migrate/20140422061712_create_bracket_matches.rb b/db/migrate/20140422195139_create_bracket_matches.rb
index 3323e31..3323e31 100644
--- a/db/migrate/20140422061712_create_bracket_matches.rb
+++ b/db/migrate/20140422195139_create_bracket_matches.rb
diff --git a/db/migrate/20140422061715_create_api_requests.rb b/db/migrate/20140422195143_create_api_requests.rb
index 544c330..544c330 100644
--- a/db/migrate/20140422061715_create_api_requests.rb
+++ b/db/migrate/20140422195143_create_api_requests.rb
diff --git a/db/migrate/20140422061718_create_tournament_players_join_table.rb b/db/migrate/20140422195146_create_tournament_players_join_table.rb
index be240e8..be240e8 100644
--- a/db/migrate/20140422061718_create_tournament_players_join_table.rb
+++ b/db/migrate/20140422195146_create_tournament_players_join_table.rb
diff --git a/db/migrate/20140422061721_create_tournament_hosts_join_table.rb b/db/migrate/20140422195150_create_tournament_hosts_join_table.rb
index 7521d89..7521d89 100644
--- a/db/migrate/20140422061721_create_tournament_hosts_join_table.rb
+++ b/db/migrate/20140422195150_create_tournament_hosts_join_table.rb
diff --git a/db/migrate/20140422061724_create_team_user_join_table.rb b/db/migrate/20140422195153_create_team_user_join_table.rb
index f3b57fc..f3b57fc 100644
--- a/db/migrate/20140422061724_create_team_user_join_table.rb
+++ b/db/migrate/20140422195153_create_team_user_join_table.rb
diff --git a/db/migrate/20140422061727_create_match_team_join_table.rb b/db/migrate/20140422195157_create_match_team_join_table.rb
index c2ed1b7..c2ed1b7 100644
--- a/db/migrate/20140422061727_create_match_team_join_table.rb
+++ b/db/migrate/20140422195157_create_match_team_join_table.rb
diff --git a/db/migrate/20140422061739_add_hidden_attrs_to_user.rb b/db/migrate/20140422195211_add_hidden_attrs_to_user.rb
index 9b5c505..9b5c505 100644
--- a/db/migrate/20140422061739_add_hidden_attrs_to_user.rb
+++ b/db/migrate/20140422195211_add_hidden_attrs_to_user.rb
diff --git a/db/schema.rb b/db/schema.rb
index e8764b6..3f39538 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: 20140422061739) do
+ActiveRecord::Schema.define(version: 20140422195211) do
create_table "alerts", force: true do |t|
t.integer "author_id"
@@ -104,9 +104,8 @@ ActiveRecord::Schema.define(version: 20140422061739) do
create_table "matches", force: true do |t|
t.integer "status"
t.integer "tournament_stage_id"
- t.string "name"
t.integer "winner_id"
- t.string "remote_id"
+ t.text "remote_id"
t.integer "submitted_peer_evaluations"
t.datetime "created_at"
t.datetime "updated_at"
@@ -185,13 +184,10 @@ ActiveRecord::Schema.define(version: 20140422061739) do
add_index "statistics", ["user_id"], name: "index_statistics_on_user_id"
create_table "teams", force: true do |t|
- t.integer "match_id"
t.datetime "created_at"
t.datetime "updated_at"
end
- add_index "teams", ["match_id"], name: "index_teams_on_match_id"
-
create_table "teams_users", id: false, force: true do |t|
t.integer "team_id", null: false
t.integer "user_id", null: false
diff --git a/test/controllers/matches_controller_test.rb b/test/controllers/matches_controller_test.rb
index 033704e..d4ac1ed 100644
--- a/test/controllers/matches_controller_test.rb
+++ b/test/controllers/matches_controller_test.rb
@@ -18,7 +18,7 @@ class MatchesControllerTest < ActionController::TestCase
test "should create match" do
assert_difference('Match.count') do
- post :create, match: { name: @match.name, remote_id: @match.remote_id, status: @match.status, submitted_peer_evaluations: @match.submitted_peer_evaluations, tournament_stage_id: @match.tournament_stage_id, winner_id: @match.winner_id }
+ post :create, match: { remote_id: @match.remote_id, status: @match.status, submitted_peer_evaluations: @match.submitted_peer_evaluations, tournament_stage_id: @match.tournament_stage_id, winner_id: @match.winner_id }
end
assert_redirected_to match_path(assigns(:match))
@@ -35,7 +35,7 @@ class MatchesControllerTest < ActionController::TestCase
end
test "should update match" do
- patch :update, id: @match, match: { name: @match.name, remote_id: @match.remote_id, status: @match.status, submitted_peer_evaluations: @match.submitted_peer_evaluations, tournament_stage_id: @match.tournament_stage_id, winner_id: @match.winner_id }
+ patch :update, id: @match, match: { remote_id: @match.remote_id, status: @match.status, submitted_peer_evaluations: @match.submitted_peer_evaluations, tournament_stage_id: @match.tournament_stage_id, winner_id: @match.winner_id }
assert_redirected_to match_path(assigns(:match))
end
diff --git a/test/controllers/teams_controller_test.rb b/test/controllers/teams_controller_test.rb
index 52f7c17..8bf60be 100644
--- a/test/controllers/teams_controller_test.rb
+++ b/test/controllers/teams_controller_test.rb
@@ -18,7 +18,7 @@ class TeamsControllerTest < ActionController::TestCase
test "should create team" do
assert_difference('Team.count') do
- post :create, team: { match_id: @team.match_id }
+ post :create, team: { }
end
assert_redirected_to team_path(assigns(:team))
@@ -35,7 +35,7 @@ class TeamsControllerTest < ActionController::TestCase
end
test "should update team" do
- patch :update, id: @team, team: { match_id: @team.match_id }
+ patch :update, id: @team, team: { }
assert_redirected_to team_path(assigns(:team))
end
diff --git a/test/fixtures/matches.yml b/test/fixtures/matches.yml
index ff81182..4213238 100644
--- a/test/fixtures/matches.yml
+++ b/test/fixtures/matches.yml
@@ -3,15 +3,13 @@
one:
status: 1
tournament_stage_id:
- name: MyString
winner_id:
- remote_id: MyString
+ remote_id: MyText
submitted_peer_evaluations: 1
two:
status: 1
tournament_stage_id:
- name: MyString
winner_id:
- remote_id: MyString
+ remote_id: MyText
submitted_peer_evaluations: 1
diff --git a/test/fixtures/teams.yml b/test/fixtures/teams.yml
index 4efc76e..937a0c0 100644
--- a/test/fixtures/teams.yml
+++ b/test/fixtures/teams.yml
@@ -1,7 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
-one:
- match_id:
-
-two:
- match_id:
+# This model initially had no columns defined. If you add columns to the
+# model remove the '{}' from the fixture names and add the columns immediately
+# below each fixture, per the syntax in the comments below
+#
+one: {}
+# column: value
+#
+two: {}
+# column: value