summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-22 02:45:22 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-22 02:45:22 -0400
commit7d40d2ed8bd686b32ff9bc620936a72044a610bc (patch)
tree4e46ac6a1fca51e272837ef0d8f5921f3991e914 /app
parentd3bee0f1ce0c5dc3fa741338bc6d9914e9e92787 (diff)
parent07476fd9a2b942e8d6056804bb1cdbd5e9a1c528 (diff)
Merge branch 'clean2'
Conflicts: app/controllers/tournaments_controller.rb app/models/match.rb app/views/matches/index.html.erb app/views/matches/show.html.erb app/views/tournaments/index.html.erb app/views/tournaments/show.html.erb
Diffstat (limited to 'app')
-rw-r--r--app/controllers/games_controller.rb2
-rw-r--r--app/controllers/matches_controller.rb2
-rw-r--r--app/controllers/tournaments_controller.rb2
-rw-r--r--app/models/match.rb3
-rw-r--r--app/models/statistic.rb (renamed from app/models/score.rb)2
-rw-r--r--app/models/tournament_stage.rb3
-rw-r--r--app/views/games/_form.html.erb6
-rw-r--r--app/views/games/index.html.erb2
-rw-r--r--app/views/games/index.json.jbuilder2
-rw-r--r--app/views/games/show.html.erb5
-rw-r--r--app/views/games/show.json.jbuilder2
-rw-r--r--app/views/matches/_form.html.erb4
-rw-r--r--app/views/matches/index.json.jbuilder2
-rw-r--r--app/views/matches/show.html.erb4
-rw-r--r--app/views/matches/show.json.jbuilder2
-rw-r--r--app/views/tournaments/_form.html.erb12
-rw-r--r--app/views/tournaments/index.json.jbuilder2
-rw-r--r--app/views/tournaments/show.html.erb11
-rw-r--r--app/views/tournaments/show.json.jbuilder2
19 files changed, 49 insertions, 21 deletions
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb
index f18a5ad..1f0bdd8 100644
--- a/app/controllers/games_controller.rb
+++ b/app/controllers/games_controller.rb
@@ -67,6 +67,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 95f99a6..d7a8b99 100644
--- a/app/controllers/matches_controller.rb
+++ b/app/controllers/matches_controller.rb
@@ -250,7 +250,7 @@ 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
# Turn of check_edit, since our #update is flexible
diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb
index 57e73aa..b6f911f 100644
--- a/app/controllers/tournaments_controller.rb
+++ b/app/controllers/tournaments_controller.rb
@@ -136,7 +136,7 @@ class TournamentsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def tournament_params
- params.require(:tournament).permit(:game, :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, :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
def is_owner?(object)
diff --git a/app/models/match.rb b/app/models/match.rb
index ac74fe1..e37f9dc 100644
--- a/app/models/match.rb
+++ b/app/models/match.rb
@@ -1,5 +1,5 @@
class Match < ActiveRecord::Base
- belongs_to :tournament
+ belongs_to :tournament_stage
has_many :scores
has_and_belongs_to_many :teams
@@ -37,5 +37,4 @@ class Match < ActiveRecord::Base
end #while
end
#handle_asynchronously :is_match_over
-
end
diff --git a/app/models/score.rb b/app/models/statistic.rb
index 11ee9a6..341fd9d 100644
--- a/app/models/score.rb
+++ b/app/models/statistic.rb
@@ -1,4 +1,4 @@
-class Score < ActiveRecord::Base
+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 @@
<div class="field">
<%= f.label :name %><br>
- <%= f.text_area :name %>
+ <%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :min_players_per_team %><br>
@@ -39,6 +39,10 @@
<%= f.label :randomized_teams %><br>
<%= f.check_box :randomized_teams %>
</div>
+ <div class="field">
+ <%= f.label :sampling_method %><br>
+ <%= f.text_field :sampling_method %>
+ </div>
<div class="actions">
<%= f.submit %>
</div>
diff --git a/app/views/games/index.html.erb b/app/views/games/index.html.erb
index 79acd1e..abb0d8a 100644
--- a/app/views/games/index.html.erb
+++ b/app/views/games/index.html.erb
@@ -10,6 +10,7 @@
<th>Max teams per match</th>
<th>Set rounds</th>
<th>Randomized teams</th>
+ <th>Sampling method</th>
<th></th>
<th></th>
<th></th>
@@ -26,6 +27,7 @@
<td><%= game.max_teams_per_match %></td>
<td><%= game.set_rounds %></td>
<td><%= game.randomized_teams %></td>
+ <td><%= game.sampling_method %></td>
<td><%= link_to 'Show', game %></td>
<td><%= link_to 'Edit', edit_game_path(game) %></td>
<td><%= link_to 'Destroy', game, method: :delete, data: { confirm: 'Are you sure?' } %></td>
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 39d4a97..d731e3d 100644
--- a/app/views/games/show.html.erb
+++ b/app/views/games/show.html.erb
@@ -33,5 +33,10 @@
<%= @game.randomized_teams %>
</p>
+<p>
+ <strong>Sampling method:</strong>
+ <%= @game.sampling_method %>
+</p>
+
<%= 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 c9c4aac..88fe733 100644
--- a/app/views/matches/_form.html.erb
+++ b/app/views/matches/_form.html.erb
@@ -5,8 +5,8 @@
<%= f.number_field :status %>
</div>
<div class="field">
- <%= f.label :tournament_id %><br>
- <%= f.text_field :tournament_id %>
+ <%= f.label :tournament_stage_id %><br>
+ <%= f.text_field :tournament_stage_id %>
</div>
<div class="field">
<%= f.label :name %><br>
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 ba1ff9b..e7fe791 100644
--- a/app/views/matches/show.html.erb
+++ b/app/views/matches/show.html.erb
@@ -3,8 +3,8 @@
<%= @match.status %>
</p>
<p>
- <strong>Tournament:</strong>
- <%= @match.tournament.id %>
+ <strong>Tournament stage:</strong>
+ <%= @match.tournament_stage %>
</p>
<p>
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
@@ -12,10 +12,6 @@
<% end %>
<div class="field">
- <%= f.label :name %><br>
- <%= f.text_field :name %>
- </div>
- <div class="field">
<%= f.label :game_id %><br>
<%= f.text_field :game_id %>
</div>
@@ -24,6 +20,10 @@
<%= f.number_field :status %>
</div>
<div class="field">
+ <%= f.label :name %><br>
+ <%= f.text_field :name %>
+ </div>
+ <div class="field">
<%= f.label :min_players_per_team %><br>
<%= f.number_field :min_players_per_team %>
</div>
@@ -47,6 +47,10 @@
<%= f.label :randomized_teams %><br>
<%= f.check_box :randomized_teams %>
</div>
+ <div class="field">
+ <%= f.label :sampling_method %><br>
+ <%= f.text_field :sampling_method %>
+ </div>
<div class="actions">
<%= f.submit %>
</div>
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 e80e0e8..a4983f7 100644
--- a/app/views/tournaments/show.html.erb
+++ b/app/views/tournaments/show.html.erb
@@ -21,6 +21,11 @@
</p>
<p>
+ <strong>Name:</strong>
+ <%= @tournament.name %>
+</p>
+
+<p>
<strong>Min players per team:</strong>
<%= @tournament.min_players_per_team %>
</p>
@@ -46,6 +51,12 @@
<%= @tournament.randomized_teams %>
</p>
+<p>
+ <strong>Sampling method:</strong>
+ <!-- TODO -->
+ <%= @tournament.sampling_method %>
+</p>
+
</span>
<div >
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