diff options
author | DavisLWebb <davislwebb@ymail.com> | 2014-04-24 12:28:50 -0400 |
---|---|---|
committer | DavisLWebb <davislwebb@ymail.com> | 2014-04-24 12:28:50 -0400 |
commit | 1cfcd314919b05237da659428500bc3680493d6c (patch) | |
tree | 61c2bef93e265ce9940f138b6f1925a63d109a50 | |
parent | 70762cf82eadda1e19e4c886604433aab0af0e94 (diff) | |
parent | 80352d2b8c9550929e3c25e9ae0b2517532648bf (diff) |
Merge branch 'master' of https://github.com/LukeShu/Leaguer
-rw-r--r-- | app/controllers/matches_controller.rb | 14 | ||||
-rw-r--r-- | app/views/matches/show.html.erb | 3 | ||||
-rwxr-xr-x | generate.sh | 2 |
3 files changed, 9 insertions, 10 deletions
diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index 8a8b9ca..1604564 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -150,10 +150,10 @@ class MatchesController < ApplicationController # Individual scores scores = params["scores"] scores.each do |user_name, score| - Score.create(user: User.find_by_user_name(user_name), match: @match, value: score.to_i) + Statistic.create(user: User.find_by_user_name(user_name), match: @match, name: "score", value: score.to_i) end - # Team scores + # Team scores (processing for manual) team_scores = {} @match.teams.each do |team| team_scores[team] = 0 @@ -165,10 +165,10 @@ class MatchesController < ApplicationController @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 + #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 # Skip peer evaluation if there aren't enough players per team peer = false @@ -249,7 +249,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_stage_id, :winner_id, :remote_id, :submitted_peer_evaluations) + params.require(:match).permit(:status, :tournament_stage_id, :winner_id, :remote_id, :submitted_peer_evaluations, :update_action) end # Turn of check_edit, since our #update is flexible diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index e9809a2..e1fe29e 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -47,7 +47,7 @@ function score_peers() { <% if @match.status <= 1 %> <li><%= user.user_name %></li> <% else %> - <li><%= user.user_name %> - SCORE: <%= @match.scores.select{|s| s.user == user}.first.value %></li> + <li><%= user.user_name %> - SCORE: <%= Statistic.where(:name => "score", :user => user, :match => @match).first.value %></li> <% end %> <% end %> </ul></li> @@ -75,6 +75,7 @@ function score_peers() { <% end %> <% when 1 %> <!-- Started, waiting to finish --> + <!-- This will depend on the Sampling Method Eventually instead of always being Manual --> <% if @tournament.hosts.include? current_user %> <input type="hidden" name="update_action" value="finish"> <% @match.teams.each do |team| %> diff --git a/generate.sh b/generate.sh index 7d33ba3..8e29384 100755 --- a/generate.sh +++ b/generate.sh @@ -54,8 +54,6 @@ 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 |