summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornfoy <nfoy@purdue.edu>2014-04-26 21:08:56 -0400
committernfoy <nfoy@purdue.edu>2014-04-26 21:08:56 -0400
commitf156d56096e08254a249304b68ae0cb433ef9db3 (patch)
tree887892ec2c07b53e04a13309647a1bbb003137ec
parent8203b447a8c5967afa8faab0ec56c42afa566823 (diff)
parenta9a59bf0199c761ada889f23274aa0a56da50554 (diff)
Merge branch 'master' of https://github.com/LukeShu/leaguer
-rw-r--r--app/controllers/matches_controller.rb3
-rw-r--r--app/models/tournament_stage.rb23
2 files changed, 26 insertions, 0 deletions
diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb
index a2a1269..4a20df2 100644
--- a/app/controllers/matches_controller.rb
+++ b/app/controllers/matches_controller.rb
@@ -230,11 +230,14 @@ class MatchesController < ApplicationController
base_score = next_score
next_score += base_score
end
+
@match.submitted_peer_evaluations += 1
players = []; @match.teams.each{|t| players.concat(t.users.all)}
if (@match.submitted_peer_evaluations == players.count)
@match.status = 3
end
+
+
respond_to do |format|
if @match.save
format.html { redirect_to tournament_match_path(@tournament, @match), notice: 'Scores Submitted' }
diff --git a/app/models/tournament_stage.rb b/app/models/tournament_stage.rb
index 9352137..84519b9 100644
--- a/app/models/tournament_stage.rb
+++ b/app/models/tournament_stage.rb
@@ -25,6 +25,29 @@ class TournamentStage < ActiveRecord::Base
return seeding.seed.pair(matches, players)
end
+ def make_methods(dir)
+ if @methods[dir].nil? or Rails.env.development?
+ @methods[dir] = Dir.glob("#{Rails.root}/lib/#{dir}/*.rb").map{|filename| filename.sub(/.*\/(.*)\.rb/, /\1/)}
+ end
+ return @methods[dir]
+ end
+
+ def scoring_methods
+ make_methods "scoring"
+ end
+
+ def sampling_methods
+ make_methods "sampling"
+ end
+
+ def scheduling_methods
+ make_methods "scheduling"
+ end
+
+ def seeding_methods
+ make_methods "seeding"
+ end
+
# Accessors to the configured methods
def scoring