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 +- 22 files changed, 57 insertions(+), 32 deletions(-) delete mode 100644 app/models/score.rb create mode 100644 app/models/statistic.rb create mode 100644 app/models/tournament_stage.rb (limited to 'app') 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 @@ - + + @@ -21,15 +22,16 @@ <% @tournaments.each do |tournament| %> - + + 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 -- cgit v1.2.3
Name Game StatusName Min players per team Max players per team Min teams per match Max teams per match Set rounds Randomized teamsSampling method
<%= 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?' } %>