summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-27 22:25:05 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-27 22:25:05 -0400
commit35674c86626981a990e9cbcc3e95a23c5cf61356 (patch)
tree793a9a30b6ed76c83bdd95d527d74c72ed05daee /lib
parent049637ce9ac37f807234e0f679e9da6dba48767a (diff)
(incomplete) re-jigger the sampling interface
Diffstat (limited to 'lib')
-rw-r--r--lib/sampling/README.md13
-rw-r--r--lib/sampling/manual.rb18
-rw-r--r--lib/sampling/peer_review.rb4
3 files changed, 19 insertions, 16 deletions
diff --git a/lib/sampling/README.md b/lib/sampling/README.md
index 731f1d1..bde84cd 100644
--- a/lib/sampling/README.md
+++ b/lib/sampling/README.md
@@ -9,6 +9,12 @@ interface:
Returns whether or not this sampling method works with the
specified game.
+ - `can_get?(User, String setting_name) => Fixnum`
+
+ Returns whether or nat this sampling method can get a specifed
+ statistic; 0 means 'false', positive integers mean 'true', where
+ higher numbers are higher priority.
+
- `uses_remote?() => Boolean`
Return whether or not this sampling method requires remote IDs for
@@ -22,15 +28,10 @@ interface:
When given an object from `RemoteUsername#value`, give back a
human-readable/editable name to display.
- - `sampling_start(Match)`
+ - `sampling_start(Match, Array[]={:user=>User,:stat=>String})`
Fetch the statistics for a match.
- - `sampling_done?(Match) => Boolean`
-
- Returns whether or not statistics have been completely collected
- yet.
-
- `render_user_interaction(Match, User) => String`
Returns HTML to render on a page.
diff --git a/lib/sampling/manual.rb b/lib/sampling/manual.rb
index a1bf9a5..b5c97c4 100644
--- a/lib/sampling/manual.rb
+++ b/lib/sampling/manual.rb
@@ -4,6 +4,10 @@ module Sampling
return true
end
+ def can_get?(user, setting_name)
+ return 1
+ end
+
def self.uses_remote?
return false
end
@@ -16,16 +20,18 @@ module Sampling
raise "This sampling method doesn't use remote usernames."
end
- def self.sampling_start(match)
- # TODO
- end
-
- def self.sampling_done?(match)
- # TODO
+ def self.sampling_start(match, statistics)
+ # do nothing
end
def self.render_user_interaction(match, user)
# TODO
+
+ require 'erb'
+ erb_filename = File.join(__FILE__.sub(/\.rb$/, '.svg.erb'))
+ erb = ERB.new(File.read(erb_filename))
+ erb.filename = erb_filename
+ return erb.result.html_safe
end
def self.handle_user_interaction(match, user, sampling_params)
diff --git a/lib/sampling/peer_review.rb b/lib/sampling/peer_review.rb
index 9f1833d..cbbd2f9 100644
--- a/lib/sampling/peer_review.rb
+++ b/lib/sampling/peer_review.rb
@@ -20,10 +20,6 @@ module Sampling
# do nothing
end
- def self.sampling_done?(match)
- return get_feedbacks_missing(match).empty?
- end
-
def self.render_user_interaction(match, user)
@user = user
@team = get_team(match)