diff options
author | AndrewMurrell <amurrel@purdue.edu> | 2014-04-26 20:24:56 -0400 |
---|---|---|
committer | AndrewMurrell <amurrel@purdue.edu> | 2014-04-26 20:24:56 -0400 |
commit | 7d97ad8ff641c1f5d67706bec053c77ece70b18a (patch) | |
tree | de8da5f4089370e5f5ce340592253d705657a885 | |
parent | 0151cd4e338cee9cef1d44292c7e80cc8d6d9b4e (diff) |
Made tons of red. Scheduling works from lib.
-rw-r--r-- | app/controllers/matches_controller.rb | 48 |
1 files changed, 4 insertions, 44 deletions
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 |