From 96274bb53465d90632908ebc2f8fd9811d7a5bcb Mon Sep 17 00:00:00 2001
From: Luke Shumaker
Date: Tue, 22 Apr 2014 02:14:25 -0400
Subject: generate.sh: add discussed changes
---
generate.sh | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/generate.sh b/generate.sh
index 7bf87e5..b8651c2 100755
--- a/generate.sh
+++ b/generate.sh
@@ -21,19 +21,12 @@ bundle exec rails generate delayed_job:active_record
# The whole shebang, models, views, and controllers
bundle exec rails generate scaffold server default_user_permissions:integer
-bundle exec rails generate scaffold match status:integer tournament:references name:string winner:references remote_id:string submitted_peer_evaluations:integer
+bundle exec rails generate scaffold match status:integer tournament_stage:references name:string winner:references remote_id:string submitted_peer_evaluations:integer
bundle exec rails generate scaffold team match:references
bundle exec rails generate scaffold alert author:references message:text
bundle exec rails generate scaffold pm author:references recipient:references message:text
-bundle exec rails generate scaffold tournament name:string:unique game:references status:integer \
- min_players_per_team:integer max_players_per_team:integer \
- min_teams_per_match:integer max_teams_per_match:integer \
- set_rounds:integer randomized_teams:boolean
-bundle exec rails generate scaffold game \
- name:text \
- min_players_per_team:integer max_players_per_team:integer \
- min_teams_per_match:integer max_teams_per_match:integer \
- set_rounds:integer randomized_teams:boolean
+bundle exec rails generate scaffold tournament game:references status:integer name:string:uniq min_players_per_team:integer max_players_per_team:integer min_teams_per_match:integer max_teams_per_match:integer set_rounds:integer randomized_teams:boolean sampling_method:string
+bundle exec rails generate scaffold game name:string:uniq min_players_per_team:integer max_players_per_team:integer min_teams_per_match:integer max_teams_per_match:integer set_rounds:integer randomized_teams:boolean sampling_method:string
bundle exec rails generate scaffold user name:string email:string:uniq user_name:string:uniq
bundle exec rails generate scaffold session user:references token:string:uniq
bundle exec rails generate scaffold bracket user:references tournament:references name:string
@@ -42,9 +35,13 @@ bundle exec rails generate scaffold bracket user:references tournament:reference
bundle exec rails generate model game_setting game:references name:string vartype:integer type_opt:text description:text display_order:integer default:text
bundle exec rails generate model tournament_setting tournament:references name:string vartype:integer type_opt:text description:text display_order:integer value:text
-bundle exec rails generate model score user:references match:references value:integer
+bundle exec rails generate model tournament_stage tournament:references scheduling:string structure:text
+bundle exec rails generate model statistic user:references match:references name:string value:integer
+
bundle exec rails generate model remote_username game:references user:references json_value:text
+
bundle exec rails generate model bracket_match bracket:references match:references predicted_winner:references
+
bundle exec rails generate model api_requests api_name:string
# Join tables
--
cgit v1.2.3-54-g00ecf
From 07476fd9a2b942e8d6056804bb1cdbd5e9a1c528 Mon Sep 17 00:00:00 2001
From: Luke Shumaker
Date: Tue, 22 Apr 2014 02:18:48 -0400
Subject: run ./generate.sh
---
app/controllers/games_controller.rb | 2 +-
app/controllers/matches_controller.rb | 2 +-
app/controllers/tournaments_controller.rb | 2 +-
app/models/match.rb | 2 +-
app/models/score.rb | 4 --
app/models/statistic.rb | 4 ++
app/models/tournament_stage.rb | 3 ++
app/views/games/_form.html.erb | 6 ++-
app/views/games/index.html.erb | 2 +
app/views/games/index.json.jbuilder | 2 +-
app/views/games/show.html.erb | 5 +++
app/views/games/show.json.jbuilder | 2 +-
app/views/matches/_form.html.erb | 4 +-
app/views/matches/index.html.erb | 4 +-
app/views/matches/index.json.jbuilder | 2 +-
app/views/matches/show.html.erb | 4 +-
app/views/matches/show.json.jbuilder | 2 +-
app/views/tournaments/_form.html.erb | 12 ++++--
app/views/tournaments/index.html.erb | 6 ++-
app/views/tournaments/index.json.jbuilder | 2 +-
app/views/tournaments/show.html.erb | 15 ++++---
app/views/tournaments/show.json.jbuilder | 2 +-
.../20140421103137_create_simple_captcha_data.rb | 15 -------
db/migrate/20140421143140_create_delayed_jobs.rb | 22 ----------
db/migrate/20140421143143_create_servers.rb | 9 ----
db/migrate/20140421143146_create_matches.rb | 14 -------
db/migrate/20140421143149_create_teams.rb | 9 ----
db/migrate/20140421143152_create_alerts.rb | 10 -----
db/migrate/20140421143155_create_pms.rb | 11 -----
db/migrate/20140421143158_create_tournaments.rb | 17 --------
db/migrate/20140421143201_create_games.rb | 15 -------
db/migrate/20140421143204_create_users.rb | 13 ------
db/migrate/20140421143207_create_sessions.rb | 11 -----
db/migrate/20140421143210_create_brackets.rb | 11 -----
db/migrate/20140421143213_create_game_settings.rb | 15 -------
.../20140421143216_create_tournament_settings.rb | 15 -------
db/migrate/20140421143219_create_scores.rb | 11 -----
.../20140421143222_create_remote_usernames.rb | 11 -----
.../20140421143225_create_bracket_matches.rb | 11 -----
db/migrate/20140421143228_create_api_requests.rb | 9 ----
...1143231_create_tournament_players_join_table.rb | 8 ----
...421143234_create_tournament_hosts_join_table.rb | 8 ----
.../20140421143237_create_team_user_join_table.rb | 8 ----
.../20140421143239_create_match_team_join_table.rb | 8 ----
.../20140421143251_add_hidden_attrs_to_user.rb | 6 ---
.../20140422021622_create_simple_captcha_data.rb | 15 +++++++
db/migrate/20140422061625_create_delayed_jobs.rb | 22 ++++++++++
db/migrate/20140422061628_create_servers.rb | 9 ++++
db/migrate/20140422061631_create_matches.rb | 14 +++++++
db/migrate/20140422061633_create_teams.rb | 9 ++++
db/migrate/20140422061636_create_alerts.rb | 10 +++++
db/migrate/20140422061639_create_pms.rb | 11 +++++
db/migrate/20140422061642_create_tournaments.rb | 19 +++++++++
db/migrate/20140422061645_create_games.rb | 17 ++++++++
db/migrate/20140422061648_create_users.rb | 13 ++++++
db/migrate/20140422061651_create_sessions.rb | 11 +++++
db/migrate/20140422061654_create_brackets.rb | 11 +++++
db/migrate/20140422061657_create_game_settings.rb | 15 +++++++
.../20140422061700_create_tournament_settings.rb | 15 +++++++
.../20140422061703_create_tournament_stages.rb | 11 +++++
db/migrate/20140422061706_create_statistics.rb | 12 ++++++
.../20140422061709_create_remote_usernames.rb | 11 +++++
.../20140422061712_create_bracket_matches.rb | 11 +++++
db/migrate/20140422061715_create_api_requests.rb | 9 ++++
...2061718_create_tournament_players_join_table.rb | 8 ++++
...422061721_create_tournament_hosts_join_table.rb | 8 ++++
.../20140422061724_create_team_user_join_table.rb | 8 ++++
.../20140422061727_create_match_team_join_table.rb | 8 ++++
.../20140422061739_add_hidden_attrs_to_user.rb | 6 +++
db/schema.rb | 48 ++++++++++++++--------
test/controllers/games_controller_test.rb | 4 +-
test/controllers/matches_controller_test.rb | 4 +-
test/controllers/tournaments_controller_test.rb | 4 +-
test/fixtures/games.yml | 6 ++-
test/fixtures/matches.yml | 4 +-
test/fixtures/scores.yml | 11 -----
test/fixtures/statistics.yml | 13 ++++++
test/fixtures/tournament_stages.yml | 11 +++++
test/fixtures/tournaments.yml | 6 ++-
test/models/score_test.rb | 7 ----
test/models/statistic_test.rb | 7 ++++
test/models/tournament_stage_test.rb | 7 ++++
82 files changed, 426 insertions(+), 345 deletions(-)
delete mode 100644 app/models/score.rb
create mode 100644 app/models/statistic.rb
create mode 100644 app/models/tournament_stage.rb
delete mode 100644 db/migrate/20140421103137_create_simple_captcha_data.rb
delete mode 100644 db/migrate/20140421143140_create_delayed_jobs.rb
delete mode 100644 db/migrate/20140421143143_create_servers.rb
delete mode 100644 db/migrate/20140421143146_create_matches.rb
delete mode 100644 db/migrate/20140421143149_create_teams.rb
delete mode 100644 db/migrate/20140421143152_create_alerts.rb
delete mode 100644 db/migrate/20140421143155_create_pms.rb
delete mode 100644 db/migrate/20140421143158_create_tournaments.rb
delete mode 100644 db/migrate/20140421143201_create_games.rb
delete mode 100644 db/migrate/20140421143204_create_users.rb
delete mode 100644 db/migrate/20140421143207_create_sessions.rb
delete mode 100644 db/migrate/20140421143210_create_brackets.rb
delete mode 100644 db/migrate/20140421143213_create_game_settings.rb
delete mode 100644 db/migrate/20140421143216_create_tournament_settings.rb
delete mode 100644 db/migrate/20140421143219_create_scores.rb
delete mode 100644 db/migrate/20140421143222_create_remote_usernames.rb
delete mode 100644 db/migrate/20140421143225_create_bracket_matches.rb
delete mode 100644 db/migrate/20140421143228_create_api_requests.rb
delete mode 100644 db/migrate/20140421143231_create_tournament_players_join_table.rb
delete mode 100644 db/migrate/20140421143234_create_tournament_hosts_join_table.rb
delete mode 100644 db/migrate/20140421143237_create_team_user_join_table.rb
delete mode 100644 db/migrate/20140421143239_create_match_team_join_table.rb
delete mode 100644 db/migrate/20140421143251_add_hidden_attrs_to_user.rb
create mode 100644 db/migrate/20140422021622_create_simple_captcha_data.rb
create mode 100644 db/migrate/20140422061625_create_delayed_jobs.rb
create mode 100644 db/migrate/20140422061628_create_servers.rb
create mode 100644 db/migrate/20140422061631_create_matches.rb
create mode 100644 db/migrate/20140422061633_create_teams.rb
create mode 100644 db/migrate/20140422061636_create_alerts.rb
create mode 100644 db/migrate/20140422061639_create_pms.rb
create mode 100644 db/migrate/20140422061642_create_tournaments.rb
create mode 100644 db/migrate/20140422061645_create_games.rb
create mode 100644 db/migrate/20140422061648_create_users.rb
create mode 100644 db/migrate/20140422061651_create_sessions.rb
create mode 100644 db/migrate/20140422061654_create_brackets.rb
create mode 100644 db/migrate/20140422061657_create_game_settings.rb
create mode 100644 db/migrate/20140422061700_create_tournament_settings.rb
create mode 100644 db/migrate/20140422061703_create_tournament_stages.rb
create mode 100644 db/migrate/20140422061706_create_statistics.rb
create mode 100644 db/migrate/20140422061709_create_remote_usernames.rb
create mode 100644 db/migrate/20140422061712_create_bracket_matches.rb
create mode 100644 db/migrate/20140422061715_create_api_requests.rb
create mode 100644 db/migrate/20140422061718_create_tournament_players_join_table.rb
create mode 100644 db/migrate/20140422061721_create_tournament_hosts_join_table.rb
create mode 100644 db/migrate/20140422061724_create_team_user_join_table.rb
create mode 100644 db/migrate/20140422061727_create_match_team_join_table.rb
create mode 100644 db/migrate/20140422061739_add_hidden_attrs_to_user.rb
delete mode 100644 test/fixtures/scores.yml
create mode 100644 test/fixtures/statistics.yml
create mode 100644 test/fixtures/tournament_stages.yml
delete mode 100644 test/models/score_test.rb
create mode 100644 test/models/statistic_test.rb
create mode 100644 test/models/tournament_stage_test.rb
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb
index e9620b4..db610bc 100644
--- a/app/controllers/games_controller.rb
+++ b/app/controllers/games_controller.rb
@@ -69,6 +69,6 @@ class GamesController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def game_params
- params.require(:game).permit(:name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams)
+ params.require(:game).permit(:name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method)
end
end
diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb
index 968bb1e..b19faf4 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_id, :name, :winner_id, :remote_id, :submitted_peer_evaluations)
+ params.require(:match).permit(:status, :tournament_stage_id, :name, :winner_id, :remote_id, :submitted_peer_evaluations)
end
end
diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb
index e43976c..6bf79fd 100644
--- a/app/controllers/tournaments_controller.rb
+++ b/app/controllers/tournaments_controller.rb
@@ -69,6 +69,6 @@ class TournamentsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def tournament_params
- params.require(:tournament).permit(:name, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams)
+ params.require(:tournament).permit(:game_id, :status, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method)
end
end
diff --git a/app/models/match.rb b/app/models/match.rb
index fe68d31..b5f539b 100644
--- a/app/models/match.rb
+++ b/app/models/match.rb
@@ -1,4 +1,4 @@
class Match < ActiveRecord::Base
- belongs_to :tournament
+ belongs_to :tournament_stage
belongs_to :winner
end
diff --git a/app/models/score.rb b/app/models/score.rb
deleted file mode 100644
index 11ee9a6..0000000
--- a/app/models/score.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-class Score < ActiveRecord::Base
- belongs_to :user
- belongs_to :match
-end
diff --git a/app/models/statistic.rb b/app/models/statistic.rb
new file mode 100644
index 0000000..341fd9d
--- /dev/null
+++ b/app/models/statistic.rb
@@ -0,0 +1,4 @@
+class Statistic < ActiveRecord::Base
+ belongs_to :user
+ belongs_to :match
+end
diff --git a/app/models/tournament_stage.rb b/app/models/tournament_stage.rb
new file mode 100644
index 0000000..205c8cc
--- /dev/null
+++ b/app/models/tournament_stage.rb
@@ -0,0 +1,3 @@
+class TournamentStage < ActiveRecord::Base
+ belongs_to :tournament
+end
diff --git a/app/views/games/_form.html.erb b/app/views/games/_form.html.erb
index f68e28f..ef250ad 100644
--- a/app/views/games/_form.html.erb
+++ b/app/views/games/_form.html.erb
@@ -13,7 +13,7 @@
<%= f.label :name %>
- <%= f.text_area :name %>
+ <%= f.text_field :name %>
<%= f.label :min_players_per_team %>
@@ -39,6 +39,10 @@
<%= f.label :randomized_teams %>
<%= f.check_box :randomized_teams %>
+
+ <%= f.label :sampling_method %>
+ <%= f.text_field :sampling_method %>
+
<%= f.submit %>
diff --git a/app/views/games/index.html.erb b/app/views/games/index.html.erb
index 27c5860..6cc7f58 100644
--- a/app/views/games/index.html.erb
+++ b/app/views/games/index.html.erb
@@ -10,6 +10,7 @@
Max teams per match |
Set rounds |
Randomized teams |
+ Sampling method |
|
|
|
@@ -26,6 +27,7 @@
<%= game.max_teams_per_match %> |
<%= game.set_rounds %> |
<%= game.randomized_teams %> |
+ <%= game.sampling_method %> |
<%= link_to 'Show', game %> |
<%= link_to 'Edit', edit_game_path(game) %> |
<%= link_to 'Destroy', game, method: :delete, data: { confirm: 'Are you sure?' } %> |
diff --git a/app/views/games/index.json.jbuilder b/app/views/games/index.json.jbuilder
index f8b3e96..cc0afc9 100644
--- a/app/views/games/index.json.jbuilder
+++ b/app/views/games/index.json.jbuilder
@@ -1,4 +1,4 @@
json.array!(@games) do |game|
- json.extract! game, :id, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams
+ json.extract! game, :id, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method
json.url game_url(game, format: :json)
end
diff --git a/app/views/games/show.html.erb b/app/views/games/show.html.erb
index 1f1a154..93bfb60 100644
--- a/app/views/games/show.html.erb
+++ b/app/views/games/show.html.erb
@@ -35,5 +35,10 @@
<%= @game.randomized_teams %>
+
+ Sampling method:
+ <%= @game.sampling_method %>
+
+
<%= link_to 'Edit', edit_game_path(@game) %> |
<%= link_to 'Back', games_path %>
diff --git a/app/views/games/show.json.jbuilder b/app/views/games/show.json.jbuilder
index e689e7b..60d0a4a 100644
--- a/app/views/games/show.json.jbuilder
+++ b/app/views/games/show.json.jbuilder
@@ -1 +1 @@
-json.extract! @game, :id, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :created_at, :updated_at
+json.extract! @game, :id, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method, :created_at, :updated_at
diff --git a/app/views/matches/_form.html.erb b/app/views/matches/_form.html.erb
index bb33501..65069d1 100644
--- a/app/views/matches/_form.html.erb
+++ b/app/views/matches/_form.html.erb
@@ -16,8 +16,8 @@
<%= f.number_field :status %>
- <%= f.label :tournament_id %>
- <%= f.text_field :tournament_id %>
+ <%= f.label :tournament_stage_id %>
+ <%= f.text_field :tournament_stage_id %>
<%= f.label :name %>
diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb
index 7b7676a..414d57d 100644
--- a/app/views/matches/index.html.erb
+++ b/app/views/matches/index.html.erb
@@ -4,7 +4,7 @@
Status |
- Tournament |
+ Tournament stage |
Name |
Winner |
Remote |
@@ -19,7 +19,7 @@
<% @matches.each do |match| %>
<%= match.status %> |
- <%= match.tournament %> |
+ <%= match.tournament_stage %> |
<%= match.name %> |
<%= match.winner %> |
<%= match.remote_id %> |
diff --git a/app/views/matches/index.json.jbuilder b/app/views/matches/index.json.jbuilder
index 8efb8f9..f2499ac 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_id, :name, :winner_id, :remote_id, :submitted_peer_evaluations
+ json.extract! match, :id, :status, :tournament_stage_id, :name, :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 1164113..3356e28 100644
--- a/app/views/matches/show.html.erb
+++ b/app/views/matches/show.html.erb
@@ -6,8 +6,8 @@
- Tournament:
- <%= @match.tournament %>
+ Tournament stage:
+ <%= @match.tournament_stage %>
diff --git a/app/views/matches/show.json.jbuilder b/app/views/matches/show.json.jbuilder
index 37496c9..5b543ea 100644
--- a/app/views/matches/show.json.jbuilder
+++ b/app/views/matches/show.json.jbuilder
@@ -1 +1 @@
-json.extract! @match, :id, :status, :tournament_id, :name, :winner_id, :remote_id, :submitted_peer_evaluations, :created_at, :updated_at
+json.extract! @match, :id, :status, :tournament_stage_id, :name, :winner_id, :remote_id, :submitted_peer_evaluations, :created_at, :updated_at
diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb
index 38855a0..9b9681c 100644
--- a/app/views/tournaments/_form.html.erb
+++ b/app/views/tournaments/_form.html.erb
@@ -11,10 +11,6 @@
<% end %>
-
- <%= f.label :name %>
- <%= f.text_field :name %>
-
<%= f.label :game_id %>
<%= f.text_field :game_id %>
@@ -23,6 +19,10 @@
<%= f.label :status %>
<%= f.number_field :status %>
+
+ <%= f.label :name %>
+ <%= f.text_field :name %>
+
<%= f.label :min_players_per_team %>
<%= f.number_field :min_players_per_team %>
@@ -47,6 +47,10 @@
<%= f.label :randomized_teams %>
<%= f.check_box :randomized_teams %>
+
+ <%= f.label :sampling_method %>
+ <%= f.text_field :sampling_method %>
+
<%= f.submit %>
diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb
index f8f21e7..49a83ec 100644
--- a/app/views/tournaments/index.html.erb
+++ b/app/views/tournaments/index.html.erb
@@ -3,15 +3,16 @@
- Name |
Game |
Status |
+ Name |
Min players per team |
Max players per team |
Min teams per match |
Max teams per match |
Set rounds |
Randomized teams |
+ Sampling method |
|
|
|
@@ -21,15 +22,16 @@
<% @tournaments.each do |tournament| %>
- <%= tournament.name %> |
<%= tournament.game %> |
<%= tournament.status %> |
+ <%= tournament.name %> |
<%= tournament.min_players_per_team %> |
<%= tournament.max_players_per_team %> |
<%= tournament.min_teams_per_match %> |
<%= tournament.max_teams_per_match %> |
<%= tournament.set_rounds %> |
<%= tournament.randomized_teams %> |
+ <%= tournament.sampling_method %> |
<%= link_to 'Show', tournament %> |
<%= link_to 'Edit', edit_tournament_path(tournament) %> |
<%= link_to 'Destroy', tournament, method: :delete, data: { confirm: 'Are you sure?' } %> |
diff --git a/app/views/tournaments/index.json.jbuilder b/app/views/tournaments/index.json.jbuilder
index 4038f04..7118ecc 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, :name, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams
+ json.extract! tournament, :id, :game_id, :status, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method
json.url tournament_url(tournament, format: :json)
end
diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb
index 3cb6179..d97e504 100644
--- a/app/views/tournaments/show.html.erb
+++ b/app/views/tournaments/show.html.erb
@@ -1,10 +1,5 @@
<%= notice %>
-
- Name:
- <%= @tournament.name %>
-
-
Game:
<%= @tournament.game %>
@@ -15,6 +10,11 @@
<%= @tournament.status %>
+
+ Name:
+ <%= @tournament.name %>
+
+
Min players per team:
<%= @tournament.min_players_per_team %>
@@ -45,5 +45,10 @@
<%= @tournament.randomized_teams %>
+
+ Sampling method:
+ <%= @tournament.sampling_method %>
+
+
<%= link_to 'Edit', edit_tournament_path(@tournament) %> |
<%= link_to 'Back', tournaments_path %>
diff --git a/app/views/tournaments/show.json.jbuilder b/app/views/tournaments/show.json.jbuilder
index 27fd5c0..4542e52 100644
--- a/app/views/tournaments/show.json.jbuilder
+++ b/app/views/tournaments/show.json.jbuilder
@@ -1 +1 @@
-json.extract! @tournament, :id, :name, :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
+json.extract! @tournament, :id, :game_id, :status, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method, :created_at, :updated_at
diff --git a/db/migrate/20140421103137_create_simple_captcha_data.rb b/db/migrate/20140421103137_create_simple_captcha_data.rb
deleted file mode 100644
index 4573b20..0000000
--- a/db/migrate/20140421103137_create_simple_captcha_data.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class CreateSimpleCaptchaData < ActiveRecord::Migration
- def self.up
- create_table :simple_captcha_data do |t|
- t.string :key, :limit => 40
- t.string :value, :limit => 6
- t.timestamps
- end
-
- add_index :simple_captcha_data, :key, :name => "idx_key"
- end
-
- def self.down
- drop_table :simple_captcha_data
- end
-end
diff --git a/db/migrate/20140421143140_create_delayed_jobs.rb b/db/migrate/20140421143140_create_delayed_jobs.rb
deleted file mode 100644
index ec0dd93..0000000
--- a/db/migrate/20140421143140_create_delayed_jobs.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-class CreateDelayedJobs < ActiveRecord::Migration
- def self.up
- create_table :delayed_jobs, :force => true do |table|
- table.integer :priority, :default => 0, :null => false # Allows some jobs to jump to the front of the queue
- table.integer :attempts, :default => 0, :null => false # Provides for retries, but still fail eventually.
- table.text :handler, :null => false # YAML-encoded string of the object that will do work
- table.text :last_error # reason for last failure (See Note below)
- table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
- table.datetime :locked_at # Set when a client is working on this object
- table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
- table.string :locked_by # Who is working on this object (if locked)
- table.string :queue # The name of the queue this job is in
- table.timestamps
- end
-
- add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'
- end
-
- def self.down
- drop_table :delayed_jobs
- end
-end
diff --git a/db/migrate/20140421143143_create_servers.rb b/db/migrate/20140421143143_create_servers.rb
deleted file mode 100644
index fbe1b02..0000000
--- a/db/migrate/20140421143143_create_servers.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class CreateServers < ActiveRecord::Migration
- def change
- create_table :servers do |t|
- t.integer :default_user_permissions
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20140421143146_create_matches.rb b/db/migrate/20140421143146_create_matches.rb
deleted file mode 100644
index bdeb1cd..0000000
--- a/db/migrate/20140421143146_create_matches.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-class CreateMatches < ActiveRecord::Migration
- def change
- create_table :matches do |t|
- t.integer :status
- t.references :tournament, index: true
- t.string :name
- t.references :winner, index: true
- t.string :remote_id
- t.integer :submitted_peer_evaluations
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20140421143149_create_teams.rb b/db/migrate/20140421143149_create_teams.rb
deleted file mode 100644
index fdf9a68..0000000
--- a/db/migrate/20140421143149_create_teams.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class CreateTeams < ActiveRecord::Migration
- def change
- create_table :teams do |t|
- t.references :match, index: true
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20140421143152_create_alerts.rb b/db/migrate/20140421143152_create_alerts.rb
deleted file mode 100644
index 68a8e10..0000000
--- a/db/migrate/20140421143152_create_alerts.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class CreateAlerts < ActiveRecord::Migration
- def change
- create_table :alerts do |t|
- t.references :author, index: true
- t.text :message
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20140421143155_create_pms.rb b/db/migrate/20140421143155_create_pms.rb
deleted file mode 100644
index 93bb5c6..0000000
--- a/db/migrate/20140421143155_create_pms.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class CreatePms < ActiveRecord::Migration
- def change
- create_table :pms do |t|
- t.references :author, index: true
- t.references :recipient, index: true
- t.text :message
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20140421143158_create_tournaments.rb b/db/migrate/20140421143158_create_tournaments.rb
deleted file mode 100644
index c0d8929..0000000
--- a/db/migrate/20140421143158_create_tournaments.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-class CreateTournaments < ActiveRecord::Migration
- def change
- create_table :tournaments do |t|
- t.string :name
- t.references :game, index: true
- t.integer :status
- t.integer :min_players_per_team
- t.integer :max_players_per_team
- t.integer :min_teams_per_match
- t.integer :max_teams_per_match
- t.integer :set_rounds
- t.boolean :randomized_teams
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20140421143201_create_games.rb b/db/migrate/20140421143201_create_games.rb
deleted file mode 100644
index 5e4f56f..0000000
--- a/db/migrate/20140421143201_create_games.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class CreateGames < ActiveRecord::Migration
- def change
- create_table :games do |t|
- t.text :name
- t.integer :min_players_per_team
- t.integer :max_players_per_team
- t.integer :min_teams_per_match
- t.integer :max_teams_per_match
- t.integer :set_rounds
- t.boolean :randomized_teams
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20140421143204_create_users.rb b/db/migrate/20140421143204_create_users.rb
deleted file mode 100644
index 8032870..0000000
--- a/db/migrate/20140421143204_create_users.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-class CreateUsers < ActiveRecord::Migration
- def change
- create_table :users do |t|
- t.string :name
- t.string :email
- t.string :user_name
-
- t.timestamps
- end
- add_index :users, :email, unique: true
- add_index :users, :user_name, unique: true
- end
-end
diff --git a/db/migrate/20140421143207_create_sessions.rb b/db/migrate/20140421143207_create_sessions.rb
deleted file mode 100644
index f667f1e..0000000
--- a/db/migrate/20140421143207_create_sessions.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class CreateSessions < ActiveRecord::Migration
- def change
- create_table :sessions do |t|
- t.references :user, index: true
- t.string :token
-
- t.timestamps
- end
- add_index :sessions, :token, unique: true
- end
-end
diff --git a/db/migrate/20140421143210_create_brackets.rb b/db/migrate/20140421143210_create_brackets.rb
deleted file mode 100644
index 8813bf2..0000000
--- a/db/migrate/20140421143210_create_brackets.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class CreateBrackets < ActiveRecord::Migration
- def change
- create_table :brackets do |t|
- t.references :user, index: true
- t.references :tournament, index: true
- t.string :name
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20140421143213_create_game_settings.rb b/db/migrate/20140421143213_create_game_settings.rb
deleted file mode 100644
index 06fb72e..0000000
--- a/db/migrate/20140421143213_create_game_settings.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class CreateGameSettings < ActiveRecord::Migration
- def change
- create_table :game_settings do |t|
- t.references :game, index: true
- t.string :name
- t.integer :vartype
- t.text :type_opt
- t.text :description
- t.integer :display_order
- t.text :default
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20140421143216_create_tournament_settings.rb b/db/migrate/20140421143216_create_tournament_settings.rb
deleted file mode 100644
index e56697f..0000000
--- a/db/migrate/20140421143216_create_tournament_settings.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class CreateTournamentSettings < ActiveRecord::Migration
- def change
- create_table :tournament_settings do |t|
- t.references :tournament, index: true
- t.string :name
- t.integer :vartype
- t.text :type_opt
- t.text :description
- t.integer :display_order
- t.text :value
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20140421143219_create_scores.rb b/db/migrate/20140421143219_create_scores.rb
deleted file mode 100644
index 4ca0b0b..0000000
--- a/db/migrate/20140421143219_create_scores.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class CreateScores < ActiveRecord::Migration
- def change
- create_table :scores do |t|
- t.references :user, index: true
- t.references :match, index: true
- t.integer :value
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20140421143222_create_remote_usernames.rb b/db/migrate/20140421143222_create_remote_usernames.rb
deleted file mode 100644
index e265985..0000000
--- a/db/migrate/20140421143222_create_remote_usernames.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class CreateRemoteUsernames < ActiveRecord::Migration
- def change
- create_table :remote_usernames do |t|
- t.references :game, index: true
- t.references :user, index: true
- t.text :json_value
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20140421143225_create_bracket_matches.rb b/db/migrate/20140421143225_create_bracket_matches.rb
deleted file mode 100644
index 3323e31..0000000
--- a/db/migrate/20140421143225_create_bracket_matches.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class CreateBracketMatches < ActiveRecord::Migration
- def change
- create_table :bracket_matches do |t|
- t.references :bracket, index: true
- t.references :match, index: true
- t.references :predicted_winner, index: true
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20140421143228_create_api_requests.rb b/db/migrate/20140421143228_create_api_requests.rb
deleted file mode 100644
index 544c330..0000000
--- a/db/migrate/20140421143228_create_api_requests.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class CreateApiRequests < ActiveRecord::Migration
- def change
- create_table :api_requests do |t|
- t.string :api_name
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20140421143231_create_tournament_players_join_table.rb b/db/migrate/20140421143231_create_tournament_players_join_table.rb
deleted file mode 100644
index be240e8..0000000
--- a/db/migrate/20140421143231_create_tournament_players_join_table.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-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/20140421143234_create_tournament_hosts_join_table.rb b/db/migrate/20140421143234_create_tournament_hosts_join_table.rb
deleted file mode 100644
index 7521d89..0000000
--- a/db/migrate/20140421143234_create_tournament_hosts_join_table.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-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/20140421143237_create_team_user_join_table.rb b/db/migrate/20140421143237_create_team_user_join_table.rb
deleted file mode 100644
index f3b57fc..0000000
--- a/db/migrate/20140421143237_create_team_user_join_table.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-class CreateTeamUserJoinTable < ActiveRecord::Migration
- def change
- create_join_table :teams, :users do |t|
- # t.index [:team_id, :user_id]
- # t.index [:user_id, :team_id]
- end
- end
-end
diff --git a/db/migrate/20140421143239_create_match_team_join_table.rb b/db/migrate/20140421143239_create_match_team_join_table.rb
deleted file mode 100644
index c2ed1b7..0000000
--- a/db/migrate/20140421143239_create_match_team_join_table.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-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/20140421143251_add_hidden_attrs_to_user.rb b/db/migrate/20140421143251_add_hidden_attrs_to_user.rb
deleted file mode 100644
index 9b5c505..0000000
--- a/db/migrate/20140421143251_add_hidden_attrs_to_user.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class AddHiddenAttrsToUser < ActiveRecord::Migration
- def change
- add_column :users, :password_digest, :string
- add_column :users, :permissions, :integer
- end
-end
diff --git a/db/migrate/20140422021622_create_simple_captcha_data.rb b/db/migrate/20140422021622_create_simple_captcha_data.rb
new file mode 100644
index 0000000..4573b20
--- /dev/null
+++ b/db/migrate/20140422021622_create_simple_captcha_data.rb
@@ -0,0 +1,15 @@
+class CreateSimpleCaptchaData < ActiveRecord::Migration
+ def self.up
+ create_table :simple_captcha_data do |t|
+ t.string :key, :limit => 40
+ t.string :value, :limit => 6
+ t.timestamps
+ end
+
+ add_index :simple_captcha_data, :key, :name => "idx_key"
+ end
+
+ def self.down
+ drop_table :simple_captcha_data
+ end
+end
diff --git a/db/migrate/20140422061625_create_delayed_jobs.rb b/db/migrate/20140422061625_create_delayed_jobs.rb
new file mode 100644
index 0000000..ec0dd93
--- /dev/null
+++ b/db/migrate/20140422061625_create_delayed_jobs.rb
@@ -0,0 +1,22 @@
+class CreateDelayedJobs < ActiveRecord::Migration
+ def self.up
+ create_table :delayed_jobs, :force => true do |table|
+ table.integer :priority, :default => 0, :null => false # Allows some jobs to jump to the front of the queue
+ table.integer :attempts, :default => 0, :null => false # Provides for retries, but still fail eventually.
+ table.text :handler, :null => false # YAML-encoded string of the object that will do work
+ table.text :last_error # reason for last failure (See Note below)
+ table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
+ table.datetime :locked_at # Set when a client is working on this object
+ table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
+ table.string :locked_by # Who is working on this object (if locked)
+ table.string :queue # The name of the queue this job is in
+ table.timestamps
+ end
+
+ add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'
+ end
+
+ def self.down
+ drop_table :delayed_jobs
+ end
+end
diff --git a/db/migrate/20140422061628_create_servers.rb b/db/migrate/20140422061628_create_servers.rb
new file mode 100644
index 0000000..fbe1b02
--- /dev/null
+++ b/db/migrate/20140422061628_create_servers.rb
@@ -0,0 +1,9 @@
+class CreateServers < ActiveRecord::Migration
+ def change
+ create_table :servers do |t|
+ t.integer :default_user_permissions
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20140422061631_create_matches.rb b/db/migrate/20140422061631_create_matches.rb
new file mode 100644
index 0000000..3786d52
--- /dev/null
+++ b/db/migrate/20140422061631_create_matches.rb
@@ -0,0 +1,14 @@
+class CreateMatches < ActiveRecord::Migration
+ def change
+ 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.integer :submitted_peer_evaluations
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20140422061633_create_teams.rb b/db/migrate/20140422061633_create_teams.rb
new file mode 100644
index 0000000..fdf9a68
--- /dev/null
+++ b/db/migrate/20140422061633_create_teams.rb
@@ -0,0 +1,9 @@
+class CreateTeams < ActiveRecord::Migration
+ def change
+ create_table :teams do |t|
+ t.references :match, index: true
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20140422061636_create_alerts.rb b/db/migrate/20140422061636_create_alerts.rb
new file mode 100644
index 0000000..68a8e10
--- /dev/null
+++ b/db/migrate/20140422061636_create_alerts.rb
@@ -0,0 +1,10 @@
+class CreateAlerts < ActiveRecord::Migration
+ def change
+ create_table :alerts do |t|
+ t.references :author, index: true
+ t.text :message
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20140422061639_create_pms.rb b/db/migrate/20140422061639_create_pms.rb
new file mode 100644
index 0000000..93bb5c6
--- /dev/null
+++ b/db/migrate/20140422061639_create_pms.rb
@@ -0,0 +1,11 @@
+class CreatePms < ActiveRecord::Migration
+ def change
+ create_table :pms do |t|
+ t.references :author, index: true
+ t.references :recipient, index: true
+ t.text :message
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20140422061642_create_tournaments.rb b/db/migrate/20140422061642_create_tournaments.rb
new file mode 100644
index 0000000..716871f
--- /dev/null
+++ b/db/migrate/20140422061642_create_tournaments.rb
@@ -0,0 +1,19 @@
+class CreateTournaments < ActiveRecord::Migration
+ def change
+ create_table :tournaments do |t|
+ t.references :game, index: true
+ t.integer :status
+ t.string :name
+ t.integer :min_players_per_team
+ t.integer :max_players_per_team
+ t.integer :min_teams_per_match
+ t.integer :max_teams_per_match
+ t.integer :set_rounds
+ t.boolean :randomized_teams
+ t.string :sampling_method
+
+ t.timestamps
+ end
+ add_index :tournaments, :name, unique: true
+ end
+end
diff --git a/db/migrate/20140422061645_create_games.rb b/db/migrate/20140422061645_create_games.rb
new file mode 100644
index 0000000..46ed30d
--- /dev/null
+++ b/db/migrate/20140422061645_create_games.rb
@@ -0,0 +1,17 @@
+class CreateGames < ActiveRecord::Migration
+ def change
+ create_table :games do |t|
+ t.string :name
+ t.integer :min_players_per_team
+ t.integer :max_players_per_team
+ t.integer :min_teams_per_match
+ t.integer :max_teams_per_match
+ t.integer :set_rounds
+ t.boolean :randomized_teams
+ t.string :sampling_method
+
+ t.timestamps
+ end
+ add_index :games, :name, unique: true
+ end
+end
diff --git a/db/migrate/20140422061648_create_users.rb b/db/migrate/20140422061648_create_users.rb
new file mode 100644
index 0000000..8032870
--- /dev/null
+++ b/db/migrate/20140422061648_create_users.rb
@@ -0,0 +1,13 @@
+class CreateUsers < ActiveRecord::Migration
+ def change
+ create_table :users do |t|
+ t.string :name
+ t.string :email
+ t.string :user_name
+
+ t.timestamps
+ end
+ add_index :users, :email, unique: true
+ add_index :users, :user_name, unique: true
+ end
+end
diff --git a/db/migrate/20140422061651_create_sessions.rb b/db/migrate/20140422061651_create_sessions.rb
new file mode 100644
index 0000000..f667f1e
--- /dev/null
+++ b/db/migrate/20140422061651_create_sessions.rb
@@ -0,0 +1,11 @@
+class CreateSessions < ActiveRecord::Migration
+ def change
+ create_table :sessions do |t|
+ t.references :user, index: true
+ t.string :token
+
+ t.timestamps
+ end
+ add_index :sessions, :token, unique: true
+ end
+end
diff --git a/db/migrate/20140422061654_create_brackets.rb b/db/migrate/20140422061654_create_brackets.rb
new file mode 100644
index 0000000..8813bf2
--- /dev/null
+++ b/db/migrate/20140422061654_create_brackets.rb
@@ -0,0 +1,11 @@
+class CreateBrackets < ActiveRecord::Migration
+ def change
+ create_table :brackets do |t|
+ t.references :user, index: true
+ t.references :tournament, index: true
+ t.string :name
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20140422061657_create_game_settings.rb b/db/migrate/20140422061657_create_game_settings.rb
new file mode 100644
index 0000000..06fb72e
--- /dev/null
+++ b/db/migrate/20140422061657_create_game_settings.rb
@@ -0,0 +1,15 @@
+class CreateGameSettings < ActiveRecord::Migration
+ def change
+ create_table :game_settings do |t|
+ t.references :game, index: true
+ t.string :name
+ t.integer :vartype
+ t.text :type_opt
+ t.text :description
+ t.integer :display_order
+ t.text :default
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20140422061700_create_tournament_settings.rb b/db/migrate/20140422061700_create_tournament_settings.rb
new file mode 100644
index 0000000..e56697f
--- /dev/null
+++ b/db/migrate/20140422061700_create_tournament_settings.rb
@@ -0,0 +1,15 @@
+class CreateTournamentSettings < ActiveRecord::Migration
+ def change
+ create_table :tournament_settings do |t|
+ t.references :tournament, index: true
+ t.string :name
+ t.integer :vartype
+ t.text :type_opt
+ t.text :description
+ t.integer :display_order
+ t.text :value
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20140422061703_create_tournament_stages.rb b/db/migrate/20140422061703_create_tournament_stages.rb
new file mode 100644
index 0000000..e3668cb
--- /dev/null
+++ b/db/migrate/20140422061703_create_tournament_stages.rb
@@ -0,0 +1,11 @@
+class CreateTournamentStages < ActiveRecord::Migration
+ def change
+ create_table :tournament_stages do |t|
+ t.references :tournament, index: true
+ t.string :scheduling
+ t.text :structure
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20140422061706_create_statistics.rb b/db/migrate/20140422061706_create_statistics.rb
new file mode 100644
index 0000000..cc2e97d
--- /dev/null
+++ b/db/migrate/20140422061706_create_statistics.rb
@@ -0,0 +1,12 @@
+class CreateStatistics < ActiveRecord::Migration
+ def change
+ create_table :statistics do |t|
+ t.references :user, index: true
+ t.references :match, index: true
+ t.string :name
+ t.integer :value
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20140422061709_create_remote_usernames.rb b/db/migrate/20140422061709_create_remote_usernames.rb
new file mode 100644
index 0000000..e265985
--- /dev/null
+++ b/db/migrate/20140422061709_create_remote_usernames.rb
@@ -0,0 +1,11 @@
+class CreateRemoteUsernames < ActiveRecord::Migration
+ def change
+ create_table :remote_usernames do |t|
+ t.references :game, index: true
+ t.references :user, index: true
+ t.text :json_value
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20140422061712_create_bracket_matches.rb b/db/migrate/20140422061712_create_bracket_matches.rb
new file mode 100644
index 0000000..3323e31
--- /dev/null
+++ b/db/migrate/20140422061712_create_bracket_matches.rb
@@ -0,0 +1,11 @@
+class CreateBracketMatches < ActiveRecord::Migration
+ def change
+ create_table :bracket_matches do |t|
+ t.references :bracket, index: true
+ t.references :match, index: true
+ t.references :predicted_winner, index: true
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20140422061715_create_api_requests.rb b/db/migrate/20140422061715_create_api_requests.rb
new file mode 100644
index 0000000..544c330
--- /dev/null
+++ b/db/migrate/20140422061715_create_api_requests.rb
@@ -0,0 +1,9 @@
+class CreateApiRequests < ActiveRecord::Migration
+ def change
+ create_table :api_requests do |t|
+ t.string :api_name
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20140422061718_create_tournament_players_join_table.rb b/db/migrate/20140422061718_create_tournament_players_join_table.rb
new file mode 100644
index 0000000..be240e8
--- /dev/null
+++ b/db/migrate/20140422061718_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/20140422061721_create_tournament_hosts_join_table.rb b/db/migrate/20140422061721_create_tournament_hosts_join_table.rb
new file mode 100644
index 0000000..7521d89
--- /dev/null
+++ b/db/migrate/20140422061721_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/20140422061724_create_team_user_join_table.rb b/db/migrate/20140422061724_create_team_user_join_table.rb
new file mode 100644
index 0000000..f3b57fc
--- /dev/null
+++ b/db/migrate/20140422061724_create_team_user_join_table.rb
@@ -0,0 +1,8 @@
+class CreateTeamUserJoinTable < ActiveRecord::Migration
+ def change
+ create_join_table :teams, :users do |t|
+ # t.index [:team_id, :user_id]
+ # t.index [:user_id, :team_id]
+ end
+ end
+end
diff --git a/db/migrate/20140422061727_create_match_team_join_table.rb b/db/migrate/20140422061727_create_match_team_join_table.rb
new file mode 100644
index 0000000..c2ed1b7
--- /dev/null
+++ b/db/migrate/20140422061727_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/20140422061739_add_hidden_attrs_to_user.rb b/db/migrate/20140422061739_add_hidden_attrs_to_user.rb
new file mode 100644
index 0000000..9b5c505
--- /dev/null
+++ b/db/migrate/20140422061739_add_hidden_attrs_to_user.rb
@@ -0,0 +1,6 @@
+class AddHiddenAttrsToUser < ActiveRecord::Migration
+ def change
+ add_column :users, :password_digest, :string
+ add_column :users, :permissions, :integer
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 8e13073..e8764b6 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: 20140421143251) do
+ActiveRecord::Schema.define(version: 20140422061739) do
create_table "alerts", force: true do |t|
t.integer "author_id"
@@ -82,17 +82,20 @@ ActiveRecord::Schema.define(version: 20140421143251) do
add_index "game_settings", ["game_id"], name: "index_game_settings_on_game_id"
create_table "games", force: true do |t|
- t.text "name"
+ t.string "name"
t.integer "min_players_per_team"
t.integer "max_players_per_team"
t.integer "min_teams_per_match"
t.integer "max_teams_per_match"
t.integer "set_rounds"
t.boolean "randomized_teams"
+ t.string "sampling_method"
t.datetime "created_at"
t.datetime "updated_at"
end
+ add_index "games", ["name"], name: "index_games_on_name", unique: true
+
create_table "hosts_tournaments", id: false, force: true do |t|
t.integer "host_id", null: false
t.integer "tournament_id", null: false
@@ -100,7 +103,7 @@ ActiveRecord::Schema.define(version: 20140421143251) do
create_table "matches", force: true do |t|
t.integer "status"
- t.integer "tournament_id"
+ t.integer "tournament_stage_id"
t.string "name"
t.integer "winner_id"
t.string "remote_id"
@@ -109,7 +112,7 @@ ActiveRecord::Schema.define(version: 20140421143251) do
t.datetime "updated_at"
end
- add_index "matches", ["tournament_id"], name: "index_matches_on_tournament_id"
+ add_index "matches", ["tournament_stage_id"], name: "index_matches_on_tournament_stage_id"
add_index "matches", ["winner_id"], name: "index_matches_on_winner_id"
create_table "matches_teams", id: false, force: true do |t|
@@ -144,17 +147,6 @@ ActiveRecord::Schema.define(version: 20140421143251) do
add_index "remote_usernames", ["game_id"], name: "index_remote_usernames_on_game_id"
add_index "remote_usernames", ["user_id"], name: "index_remote_usernames_on_user_id"
- create_table "scores", force: true do |t|
- t.integer "user_id"
- t.integer "match_id"
- t.integer "value"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- add_index "scores", ["match_id"], name: "index_scores_on_match_id"
- add_index "scores", ["user_id"], name: "index_scores_on_user_id"
-
create_table "servers", force: true do |t|
t.integer "default_user_permissions"
t.datetime "created_at"
@@ -180,6 +172,18 @@ ActiveRecord::Schema.define(version: 20140421143251) do
add_index "simple_captcha_data", ["key"], name: "idx_key"
+ create_table "statistics", force: true do |t|
+ t.integer "user_id"
+ t.integer "match_id"
+ t.string "name"
+ t.integer "value"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "statistics", ["match_id"], name: "index_statistics_on_match_id"
+ 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"
@@ -207,21 +211,33 @@ ActiveRecord::Schema.define(version: 20140421143251) do
add_index "tournament_settings", ["tournament_id"], name: "index_tournament_settings_on_tournament_id"
+ create_table "tournament_stages", force: true do |t|
+ t.integer "tournament_id"
+ t.string "scheduling"
+ t.text "structure"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "tournament_stages", ["tournament_id"], name: "index_tournament_stages_on_tournament_id"
+
create_table "tournaments", force: true do |t|
- t.string "name"
t.integer "game_id"
t.integer "status"
+ t.string "name"
t.integer "min_players_per_team"
t.integer "max_players_per_team"
t.integer "min_teams_per_match"
t.integer "max_teams_per_match"
t.integer "set_rounds"
t.boolean "randomized_teams"
+ t.string "sampling_method"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "tournaments", ["game_id"], name: "index_tournaments_on_game_id"
+ add_index "tournaments", ["name"], name: "index_tournaments_on_name", unique: true
create_table "users", force: true do |t|
t.string "name"
diff --git a/test/controllers/games_controller_test.rb b/test/controllers/games_controller_test.rb
index b93feac..f55a226 100644
--- a/test/controllers/games_controller_test.rb
+++ b/test/controllers/games_controller_test.rb
@@ -18,7 +18,7 @@ class GamesControllerTest < ActionController::TestCase
test "should create game" do
assert_difference('Game.count') do
- post :create, game: { max_players_per_team: @game.max_players_per_team, max_teams_per_match: @game.max_teams_per_match, min_players_per_team: @game.min_players_per_team, min_teams_per_match: @game.min_teams_per_match, name: @game.name, randomized_teams: @game.randomized_teams, set_rounds: @game.set_rounds }
+ post :create, game: { max_players_per_team: @game.max_players_per_team, max_teams_per_match: @game.max_teams_per_match, min_players_per_team: @game.min_players_per_team, min_teams_per_match: @game.min_teams_per_match, name: @game.name, randomized_teams: @game.randomized_teams, sampling_method: @game.sampling_method, set_rounds: @game.set_rounds }
end
assert_redirected_to game_path(assigns(:game))
@@ -35,7 +35,7 @@ class GamesControllerTest < ActionController::TestCase
end
test "should update game" do
- patch :update, id: @game, game: { max_players_per_team: @game.max_players_per_team, max_teams_per_match: @game.max_teams_per_match, min_players_per_team: @game.min_players_per_team, min_teams_per_match: @game.min_teams_per_match, name: @game.name, randomized_teams: @game.randomized_teams, set_rounds: @game.set_rounds }
+ patch :update, id: @game, game: { max_players_per_team: @game.max_players_per_team, max_teams_per_match: @game.max_teams_per_match, min_players_per_team: @game.min_players_per_team, min_teams_per_match: @game.min_teams_per_match, name: @game.name, randomized_teams: @game.randomized_teams, sampling_method: @game.sampling_method, set_rounds: @game.set_rounds }
assert_redirected_to game_path(assigns(:game))
end
diff --git a/test/controllers/matches_controller_test.rb b/test/controllers/matches_controller_test.rb
index aca7008..033704e 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_id: @match.tournament_id, winner_id: @match.winner_id }
+ 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 }
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_id: @match.tournament_id, winner_id: @match.winner_id }
+ 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 }
assert_redirected_to match_path(assigns(:match))
end
diff --git a/test/controllers/tournaments_controller_test.rb b/test/controllers/tournaments_controller_test.rb
index d5ab2af..0e5673c 100644
--- a/test/controllers/tournaments_controller_test.rb
+++ b/test/controllers/tournaments_controller_test.rb
@@ -18,7 +18,7 @@ class TournamentsControllerTest < ActionController::TestCase
test "should create tournament" do
assert_difference('Tournament.count') do
- post :create, tournament: { game_id: @tournament.game_id, max_players_per_team: @tournament.max_players_per_team, max_teams_per_match: @tournament.max_teams_per_match, min_players_per_team: @tournament.min_players_per_team, min_teams_per_match: @tournament.min_teams_per_match, name: @tournament.name, randomized_teams: @tournament.randomized_teams, set_rounds: @tournament.set_rounds, status: @tournament.status }
+ post :create, tournament: { game_id: @tournament.game_id, max_players_per_team: @tournament.max_players_per_team, max_teams_per_match: @tournament.max_teams_per_match, min_players_per_team: @tournament.min_players_per_team, min_teams_per_match: @tournament.min_teams_per_match, name: @tournament.name, randomized_teams: @tournament.randomized_teams, sampling_method: @tournament.sampling_method, set_rounds: @tournament.set_rounds, status: @tournament.status }
end
assert_redirected_to tournament_path(assigns(:tournament))
@@ -35,7 +35,7 @@ class TournamentsControllerTest < ActionController::TestCase
end
test "should update tournament" do
- patch :update, id: @tournament, tournament: { game_id: @tournament.game_id, max_players_per_team: @tournament.max_players_per_team, max_teams_per_match: @tournament.max_teams_per_match, min_players_per_team: @tournament.min_players_per_team, min_teams_per_match: @tournament.min_teams_per_match, name: @tournament.name, randomized_teams: @tournament.randomized_teams, set_rounds: @tournament.set_rounds, status: @tournament.status }
+ patch :update, id: @tournament, tournament: { game_id: @tournament.game_id, max_players_per_team: @tournament.max_players_per_team, max_teams_per_match: @tournament.max_teams_per_match, min_players_per_team: @tournament.min_players_per_team, min_teams_per_match: @tournament.min_teams_per_match, name: @tournament.name, randomized_teams: @tournament.randomized_teams, sampling_method: @tournament.sampling_method, set_rounds: @tournament.set_rounds, status: @tournament.status }
assert_redirected_to tournament_path(assigns(:tournament))
end
diff --git a/test/fixtures/games.yml b/test/fixtures/games.yml
index 16f792e..af46a13 100644
--- a/test/fixtures/games.yml
+++ b/test/fixtures/games.yml
@@ -1,19 +1,21 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
- name: MyText
+ name: MyString
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
+ sampling_method: MyString
two:
- name: MyText
+ name: MyString
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
+ sampling_method: MyString
diff --git a/test/fixtures/matches.yml b/test/fixtures/matches.yml
index f64a72e..ff81182 100644
--- a/test/fixtures/matches.yml
+++ b/test/fixtures/matches.yml
@@ -2,7 +2,7 @@
one:
status: 1
- tournament_id:
+ tournament_stage_id:
name: MyString
winner_id:
remote_id: MyString
@@ -10,7 +10,7 @@ one:
two:
status: 1
- tournament_id:
+ tournament_stage_id:
name: MyString
winner_id:
remote_id: MyString
diff --git a/test/fixtures/scores.yml b/test/fixtures/scores.yml
deleted file mode 100644
index 26065df..0000000
--- a/test/fixtures/scores.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
-
-one:
- user_id:
- match_id:
- value: 1
-
-two:
- user_id:
- match_id:
- value: 1
diff --git a/test/fixtures/statistics.yml b/test/fixtures/statistics.yml
new file mode 100644
index 0000000..0b5b113
--- /dev/null
+++ b/test/fixtures/statistics.yml
@@ -0,0 +1,13 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
+
+one:
+ user_id:
+ match_id:
+ name: MyString
+ value: 1
+
+two:
+ user_id:
+ match_id:
+ name: MyString
+ value: 1
diff --git a/test/fixtures/tournament_stages.yml b/test/fixtures/tournament_stages.yml
new file mode 100644
index 0000000..fdb263c
--- /dev/null
+++ b/test/fixtures/tournament_stages.yml
@@ -0,0 +1,11 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
+
+one:
+ tournament_id:
+ scheduling: MyString
+ structure: MyText
+
+two:
+ tournament_id:
+ scheduling: MyString
+ structure: MyText
diff --git a/test/fixtures/tournaments.yml b/test/fixtures/tournaments.yml
index 89edc9f..714a963 100644
--- a/test/fixtures/tournaments.yml
+++ b/test/fixtures/tournaments.yml
@@ -1,23 +1,25 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
- name: MyString
game_id:
status: 1
+ name: MyString
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
+ sampling_method: MyString
two:
- name: MyString
game_id:
status: 1
+ name: MyString
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
+ sampling_method: MyString
diff --git a/test/models/score_test.rb b/test/models/score_test.rb
deleted file mode 100644
index d38cb0a..0000000
--- a/test/models/score_test.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require 'test_helper'
-
-class ScoreTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
-end
diff --git a/test/models/statistic_test.rb b/test/models/statistic_test.rb
new file mode 100644
index 0000000..e9e63bf
--- /dev/null
+++ b/test/models/statistic_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class StatisticTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/models/tournament_stage_test.rb b/test/models/tournament_stage_test.rb
new file mode 100644
index 0000000..10a3a92
--- /dev/null
+++ b/test/models/tournament_stage_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class TournamentStageTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
--
cgit v1.2.3-54-g00ecf