summaryrefslogtreecommitdiff
path: root/lib/sampling/peer_review.rb
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-28 00:04:30 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-28 00:04:30 -0400
commit33fcf6de9feaaa6f90dfe5082e08d280c930dae1 (patch)
tree236e6422575938e702fcc3d93906ef863e650499 /lib/sampling/peer_review.rb
parent2d7313767442956eab00671ac555c0ce4e583b5f (diff)
Re-jigger the sampling interface
Diffstat (limited to 'lib/sampling/peer_review.rb')
-rw-r--r--lib/sampling/peer_review.rb20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/sampling/peer_review.rb b/lib/sampling/peer_review.rb
index cbbd2f9..dd456c9 100644
--- a/lib/sampling/peer_review.rb
+++ b/lib/sampling/peer_review.rb
@@ -1,9 +1,13 @@
module Sampling
- module PeerReview
+ class PeerReview
def self.works_with?(game)
return true
end
+ def self.can_get?(setting_name)
+ return setting_name.start_with?("feedback_from_")
+ end
+
def self.uses_remote?
return false
end
@@ -16,11 +20,17 @@ module Sampling
raise "This sampling method doesn't use remote usernames."
end
- def self.sampling_start(match)
+ ####
+
+ def initialize(match)
+ @match = match
+ end
+
+ def start
# do nothing
end
- def self.render_user_interaction(match, user)
+ def render_user_interaction(user)
@user = user
@team = get_team(match)
@feedbacks_missing = get_feedbacks_missing(match)
@@ -32,11 +42,11 @@ module Sampling
return erb.result.html_safe
end
- def self.handle_user_interaction(match, reviewing_user, params)
+ def handle_user_interaction(reviewing_user, params)
i = 0
params[:peer_review].to_s.split(',').each do |user_name|
reviewed_user = User.find_by_user_name(user_name)
- user.statistics.create(match: match, value: i)
+ user.statistics.create(match: @match, value: i)
i += 1
end
end