From 36cdca9bc95599e67f73889c3ebf7d52f55f06eb Mon Sep 17 00:00:00 2001
From: AndrewMurrell
Date: Sat, 26 Apr 2014 18:45:54 -0400
Subject: Added updated Skeleton for match controller.
---
app/controllers/matches_controller.rb | 37 ++++++++++++++++++++++++++++++-----
1 file changed, 32 insertions(+), 5 deletions(-)
(limited to 'app')
diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb
index b1b283b..6709a53 100644
--- a/app/controllers/matches_controller.rb
+++ b/app/controllers/matches_controller.rb
@@ -168,6 +168,10 @@ class MatchesController < ApplicationController
def update
case params[:update_action]
when "start"
+ #
+ # Redirect to the current match page for this tournament with the correct sampling view rendered
+ #
+
@match.status = 1
respond_to do |format|
if @match.save
@@ -180,15 +184,30 @@ class MatchesController < ApplicationController
end
when "finish"
+ #
+ # Get the winner and blowout status from the params given by the correct sampling view
+ #
+
+
+ #in general
+ #provide contribution
+ #if all contributions are in, update statistics
+
+
#make this use the statistics interface for scoring and ScoringAlgorithms
@match.winner = @match.teams.find_by_id(params['winner'])
- @match.blowout = false
+ @match.statistics.create(name: "blowout", user: nil, value: 0)
- @match.statistics['Score'] = @tournament.settings['ScoringMethod'].constantize.score(@match, @match.statistics)
-=begin
+ #How to access the blowout statistic of a match:
+ @match.statistics.where(:name => "blowout").first.value
+
+
+ #@match.statistics.create(name: 'score', value: @tournament.settings.where(:name => 'Scoring Method').value.constantize.score(@match, @match.statistics)
+
+=begin
# Individual scores
#scores = params["scores"]
#scores.each do |user_name, score|
@@ -233,6 +252,10 @@ class MatchesController < ApplicationController
end
end
when "peer"
+ #
+ # Update user scores via scoring method
+ #
+
order = params[:review_action]
base_score = 2
next_score = 3
@@ -262,10 +285,14 @@ class MatchesController < ApplicationController
end
end
when "reset"
- @match.status = 0
+ #
+ # Reset Match Status to 1 in case something needs to be replayed.
+ #
+
+ @match.status = 1
respond_to do |format|
if @match.save
- format.html { redirect_to tournament_match_path(@tournament, @match), notice: 'Match Status Reset to 0' }
+ format.html { redirect_to tournament_match_path(@tournament, @match), notice: 'Match Status Reset to 1' }
format.json { head :no_content }
else
format.html { redirect_to @tournament, notice: "You don't have permission to start this match." }
--
cgit v1.2.3-2-g168b
From 96dd3fbe302eec54b34678e098d3b59710b09b5f Mon Sep 17 00:00:00 2001
From: tkimia
Date: Sat, 26 Apr 2014 19:16:19 -0400
Subject: prelim bracket control
---
app/controllers/brackets_controller.rb | 10 +++-------
app/models/user.rb | 4 ++++
app/views/brackets/new.html.erb | 4 +---
app/views/common/_show_tournament.html.erb | 7 +++++++
4 files changed, 15 insertions(+), 10 deletions(-)
(limited to 'app')
diff --git a/app/controllers/brackets_controller.rb b/app/controllers/brackets_controller.rb
index fe43ca9..ebd0c6b 100644
--- a/app/controllers/brackets_controller.rb
+++ b/app/controllers/brackets_controller.rb
@@ -12,11 +12,6 @@ class BracketsController < ApplicationController
def show
end
- # GET /brackets/new
- def new
- @bracket = Bracket.new
- end
-
# GET /brackets/1/edit
def edit
end
@@ -29,7 +24,7 @@ class BracketsController < ApplicationController
respond_to do |format|
if @bracket.save
format.html { redirect_to @bracket, notice: 'Bracket was successfully created.' }
- format.json { render action: 'show', status: :created, location: @bracket }
+ format.json { render action: 'edit', status: :created, location: @bracket }
else
format.html { render action: 'new' }
format.json { render json: @bracket.errors, status: :unprocessable_entity }
@@ -64,11 +59,12 @@ class BracketsController < ApplicationController
private
# Use callbacks to share common setup or constraints between actions.
def set_bracket
+ @tournament = Tournament.find(params[:tournament_id])
@bracket = Bracket.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def bracket_params
- params.require(:bracket).permit(:user_id, :tournament_id, :name)
+ params.fetch(:bracket, {}).permit(:user_id, :tournament_id, :name)
end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index d87f988..b2c7862 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -74,6 +74,10 @@ class User < ActiveRecord::Base
:edit_permissions => (2**19),
:edit_server => (2**20),
+
+ :create_bracket => (2**21),
+ :edit_bracket => (2**22),
+ :delete_bracket => (2**23)
}
end
diff --git a/app/views/brackets/new.html.erb b/app/views/brackets/new.html.erb
index c379c15..91d0033 100644
--- a/app/views/brackets/new.html.erb
+++ b/app/views/brackets/new.html.erb
@@ -1,5 +1,3 @@
New bracket
-<%= render 'form' %>
-
-<%= link_to 'Back', brackets_path %>
+<%= link_to 'Back', tournament_brackets_path %>
diff --git a/app/views/common/_show_tournament.html.erb b/app/views/common/_show_tournament.html.erb
index 0f60fad..fb31420 100644
--- a/app/views/common/_show_tournament.html.erb
+++ b/app/views/common/_show_tournament.html.erb
@@ -29,6 +29,13 @@
<% else %>
You've signed up for this tournament!
<% end %>
+ <%= form_tag(tournament_brackets_path(target), method: "post") do %>
+ <%= label :user_id, nil, style: "display: none;" %>
+ <%= text_field_tag :user_id, current_user.id, style: "display: none;" %>
+ <%= label :tournament_id, nil, style: "display: none;" %>
+ <%= text_field_tag :tournament_id, target.id, style: "display: none;" %>
+ <%= submit_tag("Make Bracket") %>
+ <% end %>
<% end %>
\ No newline at end of file
--
cgit v1.2.3-2-g168b
From 93e291c8e5002fdea906bb8c96cd528fa8b75935 Mon Sep 17 00:00:00 2001
From: tkimia
Date: Sat, 26 Apr 2014 19:39:57 -0400
Subject: brackets just get created
---
app/controllers/brackets_controller.rb | 17 +++++++++++++----
app/models/tournament.rb | 1 +
app/views/brackets/index.html.erb | 7 ++-----
app/views/common/_show_tournament.html.erb | 4 ----
4 files changed, 16 insertions(+), 13 deletions(-)
(limited to 'app')
diff --git a/app/controllers/brackets_controller.rb b/app/controllers/brackets_controller.rb
index ebd0c6b..37f1803 100644
--- a/app/controllers/brackets_controller.rb
+++ b/app/controllers/brackets_controller.rb
@@ -1,10 +1,11 @@
class BracketsController < ApplicationController
- before_action :set_bracket, only: [:show, :edit, :update, :destroy]
+ before_action :set_tournament, only: [:index, :create]
# GET /brackets
# GET /brackets.json
def index
- @brackets = Bracket.all
+ @tournament = Tournament.find(params[:tournament_id])
+ @brackets = @tournament.brackets
end
# GET /brackets/1
@@ -19,7 +20,7 @@ class BracketsController < ApplicationController
# POST /brackets
# POST /brackets.json
def create
- @bracket = Bracket.new(bracket_params)
+ @bracket = @tournament.brackets.create(user: current_user)
respond_to do |format|
if @bracket.save
@@ -63,8 +64,16 @@ class BracketsController < ApplicationController
@bracket = Bracket.find(params[:id])
end
+ def set_tournament
+ @tournament = Tournament.find(params[:tournament_id])
+ end
+
# Never trust parameters from the scary internet, only allow the white list through.
def bracket_params
- params.fetch(:bracket, {}).permit(:user_id, :tournament_id, :name)
+ params.require(:bracket).permit(:user_id, :tournament_id, :name)
+ end
+
+ def is_owner?(bracket)
+ bracket.user == current_user
end
end
diff --git a/app/models/tournament.rb b/app/models/tournament.rb
index 861be6c..7460a7d 100644
--- a/app/models/tournament.rb
+++ b/app/models/tournament.rb
@@ -1,6 +1,7 @@
class Tournament < ActiveRecord::Base
belongs_to :game
has_many :stages, class_name: "TournamentStage"
+ has_many :brackets
has_many :settings_raw, class_name: "TournamentSetting"
has_and_belongs_to_many :players, class_name: "User", association_foreign_key: "player_id", join_table: "players_tournaments"
has_and_belongs_to_many :hosts, class_name: "User", association_foreign_key: "host_id", join_table: "hosts_tournaments"
diff --git a/app/views/brackets/index.html.erb b/app/views/brackets/index.html.erb
index 2195d69..9effe37 100644
--- a/app/views/brackets/index.html.erb
+++ b/app/views/brackets/index.html.erb
@@ -8,7 +8,6 @@
Name |
|
|
- |
@@ -18,9 +17,8 @@
<%= bracket.user %> |
<%= bracket.tournament %> |
<%= bracket.name %> |
- <%= link_to 'Show', bracket %> |
- <%= link_to 'Edit', edit_bracket_path(bracket) %> |
- <%= link_to 'Destroy', bracket, method: :delete, data: { confirm: 'Are you sure?' } %> |
+ <%= link_to 'Show', tournament_bracket_path(@tournament, bracket) %> |
+ <%= link_to 'Edit', edit_tournament_bracket_path(@tournament, bracket) %> |
<% end %>
@@ -28,4 +26,3 @@
-<%= link_to 'New Bracket', new_bracket_path %>
diff --git a/app/views/common/_show_tournament.html.erb b/app/views/common/_show_tournament.html.erb
index fb31420..b16a37b 100644
--- a/app/views/common/_show_tournament.html.erb
+++ b/app/views/common/_show_tournament.html.erb
@@ -30,10 +30,6 @@
You've signed up for this tournament!
<% end %>
<%= form_tag(tournament_brackets_path(target), method: "post") do %>
- <%= label :user_id, nil, style: "display: none;" %>
- <%= text_field_tag :user_id, current_user.id, style: "display: none;" %>
- <%= label :tournament_id, nil, style: "display: none;" %>
- <%= text_field_tag :tournament_id, target.id, style: "display: none;" %>
<%= submit_tag("Make Bracket") %>
<% end %>
<% end %>
--
cgit v1.2.3-2-g168b
From 9eba4940c7b6f54153b3a619769bbae378be6fd8 Mon Sep 17 00:00:00 2001
From: AndrewMurrell
Date: Sat, 26 Apr 2014 20:05:45 -0400
Subject: Refactored show.html.erb for matches
---
app/views/matches/show.html.erb | 20 ++------------------
1 file changed, 2 insertions(+), 18 deletions(-)
(limited to 'app')
diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb
index 7a82527..8344a7a 100644
--- a/app/views/matches/show.html.erb
+++ b/app/views/matches/show.html.erb
@@ -78,24 +78,8 @@ function score_peers() {
- <% case @tournament.sampling_method %>
- <% when "Manual" %>
- <% if @tournament.hosts.include? current_user %>
-
- <% @match.teams.each do |team| %>
- <%= tag :input, {"type" => "radio", "name" => "winner", "value" => "#{team.id}" } %>
- <%= "Team #{team.id} Won" %>
- <% end %>
- <%= submit_tag("Finish match") %>
- <%= @tournament.settings['ScoringMethod'] %>
- <% else %>
- The match is running; the host has yet to post the scores of the match.
- <% end %>
- <% when "Double Blind" %>
- Double Blind isn't implemented yet.
- <% when "RiotAPI" %>
- Riot API is being called for Statistics. Results will appear shortly.
- <% end %>
+ <%= raw @match.tournament_stage.tournament.sampling_method.camelcase.constantize.render_user_interaction(@match, current_user) %>
+
<% when 2 %>
--
cgit v1.2.3-2-g168b
From e60adb874faffd9bac678a19043532ff33dc6b07 Mon Sep 17 00:00:00 2001
From: tkimia
Date: Sat, 26 Apr 2014 20:14:00 -0400
Subject: bracket creation is good
---
app/controllers/brackets_controller.rb | 2 ++
app/models/bracket.rb | 7 +++++++
app/views/brackets/show.html.erb | 14 ++++++++------
3 files changed, 17 insertions(+), 6 deletions(-)
(limited to 'app')
diff --git a/app/controllers/brackets_controller.rb b/app/controllers/brackets_controller.rb
index 37f1803..ed335d6 100644
--- a/app/controllers/brackets_controller.rb
+++ b/app/controllers/brackets_controller.rb
@@ -21,6 +21,8 @@ class BracketsController < ApplicationController
# POST /brackets.json
def create
@bracket = @tournament.brackets.create(user: current_user)
+ @bracket.name = current_user.user_name + "'s Prediction for " + @tournament.name
+ @bracket.create_matches
respond_to do |format|
if @bracket.save
diff --git a/app/models/bracket.rb b/app/models/bracket.rb
index e8d9c5a..acd33ca 100644
--- a/app/models/bracket.rb
+++ b/app/models/bracket.rb
@@ -1,4 +1,11 @@
class Bracket < ActiveRecord::Base
belongs_to :user
belongs_to :tournament
+ has_many :bracket_matches
+
+ def create_matches
+ tournament.stages.first.matches.each do |m|
+ bracket_matches.create(match: m)
+ end
+ end
end
diff --git a/app/views/brackets/show.html.erb b/app/views/brackets/show.html.erb
index 9c7c14b..2e92bfb 100644
--- a/app/views/brackets/show.html.erb
+++ b/app/views/brackets/show.html.erb
@@ -1,13 +1,11 @@
-<%= notice %>
-
User:
- <%= @bracket.user %>
+ <%= @bracket.user.user_name %>
Tournament:
- <%= @bracket.tournament %>
+ <%= @bracket.tournament.name %>
@@ -15,5 +13,9 @@
<%= @bracket.name %>
-<%= link_to 'Edit', edit_bracket_path(@bracket) %> |
-<%= link_to 'Back', brackets_path %>
+<% @bracket.bracket_matches.each do |m| %>
+ <%= m.match.id %>
+<% end %>
+
+
+<%= link_to 'Back', tournaments_path %>
--
cgit v1.2.3-2-g168b
From 62219ac4e3af36cc15c9ad61701550bee9a8424c Mon Sep 17 00:00:00 2001
From: Luke Shumaker
Date: Sat, 26 Apr 2014 20:16:33 -0400
Subject: run ./generate.sh
---
app/controllers/games_controller.rb | 2 +-
app/controllers/tournaments_controller.rb | 2 +-
app/views/games/_form.html.erb | 4 ++++
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/tournaments/_form.html.erb | 4 ++++
app/views/tournaments/index.html.erb | 2 ++
app/views/tournaments/index.json.jbuilder | 2 +-
app/views/tournaments/show.html.erb | 5 +++++
app/views/tournaments/show.json.jbuilder | 2 +-
12 files changed, 28 insertions(+), 6 deletions(-)
(limited to 'app')
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb
index 8546efb..76a6296 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(:parent_id, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method)
+ params.require(:game).permit(:parent_id, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method, :scoring_method)
end
end
diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb
index 6bf79fd..64ab155 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(: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)
+ 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, :scoring_method)
end
end
diff --git a/app/views/games/_form.html.erb b/app/views/games/_form.html.erb
index 20cb214..b1db0b3 100644
--- a/app/views/games/_form.html.erb
+++ b/app/views/games/_form.html.erb
@@ -47,6 +47,10 @@
<%= f.label :sampling_method %>
<%= f.text_field :sampling_method %>
+
+ <%= f.label :scoring_method %>
+ <%= f.text_field :scoring_method %>
+
<%= f.submit %>
diff --git a/app/views/games/index.html.erb b/app/views/games/index.html.erb
index b4c3950..207a0ba 100644
--- a/app/views/games/index.html.erb
+++ b/app/views/games/index.html.erb
@@ -12,6 +12,7 @@
Set rounds |
Randomized teams |
Sampling method |
+ Scoring method |
|
|
|
@@ -30,6 +31,7 @@
<%= game.set_rounds %> |
<%= game.randomized_teams %> |
<%= game.sampling_method %> |
+ <%= game.scoring_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 6b20f60..7964f2c 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, :parent_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.extract! game, :id, :parent_id, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method, :scoring_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 38c8ccb..6bca111 100644
--- a/app/views/games/show.html.erb
+++ b/app/views/games/show.html.erb
@@ -45,5 +45,10 @@
<%= @game.sampling_method %>
+
+ Scoring method:
+ <%= @game.scoring_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 087a156..c5fb4ed 100644
--- a/app/views/games/show.json.jbuilder
+++ b/app/views/games/show.json.jbuilder
@@ -1 +1 @@
-json.extract! @game, :id, :parent_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
+json.extract! @game, :id, :parent_id, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method, :scoring_method, :created_at, :updated_at
diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb
index 9b9681c..7127d38 100644
--- a/app/views/tournaments/_form.html.erb
+++ b/app/views/tournaments/_form.html.erb
@@ -51,6 +51,10 @@
<%= f.label :sampling_method %>
<%= f.text_field :sampling_method %>
+
+ <%= f.label :scoring_method %>
+ <%= f.text_field :scoring_method %>
+
<%= f.submit %>
diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb
index 49a83ec..c2b5a2b 100644
--- a/app/views/tournaments/index.html.erb
+++ b/app/views/tournaments/index.html.erb
@@ -13,6 +13,7 @@
Set rounds |
Randomized teams |
Sampling method |
+ Scoring method |
|
|
|
@@ -32,6 +33,7 @@
<%= tournament.set_rounds %> |
<%= tournament.randomized_teams %> |
<%= tournament.sampling_method %> |
+ <%= tournament.scoring_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 7118ecc..bd86e04 100644
--- a/app/views/tournaments/index.json.jbuilder
+++ b/app/views/tournaments/index.json.jbuilder
@@ -1,4 +1,4 @@
json.array!(@tournaments) do |tournament|
- json.extract! tournament, :id, :game_id, :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.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, :scoring_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 d97e504..f91e11e 100644
--- a/app/views/tournaments/show.html.erb
+++ b/app/views/tournaments/show.html.erb
@@ -50,5 +50,10 @@
<%= @tournament.sampling_method %>
+
+ Scoring method:
+ <%= @tournament.scoring_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 4542e52..ff82412 100644
--- a/app/views/tournaments/show.json.jbuilder
+++ b/app/views/tournaments/show.json.jbuilder
@@ -1 +1 @@
-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
+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, :scoring_method, :created_at, :updated_at
--
cgit v1.2.3-2-g168b
From 7d97ad8ff641c1f5d67706bec053c77ece70b18a Mon Sep 17 00:00:00 2001
From: AndrewMurrell
Date: Sat, 26 Apr 2014 20:24:56 -0400
Subject: Made tons of red. Scheduling works from lib.
---
app/controllers/matches_controller.rb | 48 +++--------------------------------
1 file changed, 4 insertions(+), 44 deletions(-)
(limited to 'app')
diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb
index 6709a53..a2a1269 100644
--- a/app/controllers/matches_controller.rb
+++ b/app/controllers/matches_controller.rb
@@ -183,54 +183,13 @@ class MatchesController < ApplicationController
end
end
when "finish"
-
#
# Get the winner and blowout status from the params given by the correct sampling view
#
-
- #in general
- #provide contribution
- #if all contributions are in, update statistics
-
-
- #make this use the statistics interface for scoring and ScoringAlgorithms
-
- @match.winner = @match.teams.find_by_id(params['winner'])
- @match.statistics.create(name: "blowout", user: nil, value: 0)
-
-
- #How to access the blowout statistic of a match:
- @match.statistics.where(:name => "blowout").first.value
-
-
-
- #@match.statistics.create(name: 'score', value: @tournament.settings.where(:name => 'Scoring Method').value.constantize.score(@match, @match.statistics)
-
-=begin
- # Individual scores
- #scores = params["scores"]
- #scores.each do |user_name, score|
- # Statistic.create(user: User.find_by_user_name(user_name), match: @match, name: "score", value: score.to_i)
- #end
-
- # Team scores (processing for manual)
- team_scores = {}
- @match.teams.each do |team|
- team_scores[team] = 0
- team.users.each do |user|
- team_scores[team] += scores[user.user_name].to_i
- end
+ unless @match.tournament_stage.tournament.sampling.sampling_done?
+ @match.tournament_stage.tournament.sampling.handle_user_interaction(@match, current_user, params)
end
- teams = team_scores.invert
- @match.winner = teams[teams.keys.sort.last]
-
- # Schedule next match
- #cur_match_num = @tournament.matches_ordered.invert[@match]
- #unless cur_match_num == 1
- # @match.winner.matches.push(@tournament.matches_ordered[cur_match_num/2])
- #end
-=end
# Skip peer evaluation if there aren't enough players per team
peer = false
@@ -241,7 +200,6 @@ class MatchesController < ApplicationController
end
@match.status = peer ? 2 : 3
-
respond_to do |format|
if @match.save
format.html { redirect_to tournament_match_path(@tournament, @match), notice: 'Peer evaluation started.' }
@@ -256,6 +214,8 @@ class MatchesController < ApplicationController
# Update user scores via scoring method
#
+ #update this to use scoring interface
+
order = params[:review_action]
base_score = 2
next_score = 3
--
cgit v1.2.3-2-g168b