From cd19b2591a52ac604632a70929448ee5e78c2568 Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Mon, 28 Apr 2014 18:29:01 -0400 Subject: Misc fixes. (This commit is from Luke on Andrew's box) --- lib/sampling/manual.rb | 4 ++-- lib/sampling/peer_review.rb | 8 ++++---- lib/scoring/winner_takes_all.rb | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/sampling/manual.rb b/lib/sampling/manual.rb index a190bd2..cfecd8f 100644 --- a/lib/sampling/manual.rb +++ b/lib/sampling/manual.rb @@ -4,7 +4,7 @@ module Sampling return true end - def can_get?(setting_name) + def self.can_get?(setting_name) return 1 end @@ -36,7 +36,7 @@ module Sampling @stats = @match.stats_from(self.class) require 'erb' - erb_filename = File.join(__FILE__.sub(/\.rb$/, '.svg.erb')) + erb_filename = File.join(__FILE__.sub(/\.rb$/, '.html.erb')) erb = ERB.new(File.read(erb_filename)) erb.filename = erb_filename return erb.result.html_safe diff --git a/lib/sampling/peer_review.rb b/lib/sampling/peer_review.rb index 4577542..e86595f 100644 --- a/lib/sampling/peer_review.rb +++ b/lib/sampling/peer_review.rb @@ -5,7 +5,7 @@ module Sampling end def self.can_get?(setting_name) - return setting_name.start_with?("feedback_from_") + return setting_name.start_with?("feedback_from_") ? 2 : 0 end def self.uses_remote? @@ -36,7 +36,7 @@ module Sampling @feedbacks_missing = get_feedbacks_missing(match) require 'erb' - erb_filename = File.join(__FILE__.sub(/\.rb$/, '.svg.erb')) + erb_filename = File.join(__FILE__.sub(/\.rb$/, '.html.erb')) erb = ERB.new(File.read(erb_filename)) erb.filename = erb_filename return erb.result.html_safe @@ -74,14 +74,14 @@ module Sampling def self.get_feedbacks_missing(match) require 'set' - ret = Set.new() + ret = Set.new feedback = get_feedbacks(match) users = get_users(match) feedback.each do |feedback| (users - feedback.keys).each do |user| - ret.push(user) + ret.add(user) end end diff --git a/lib/scoring/winner_takes_all.rb b/lib/scoring/winner_takes_all.rb index bf95781..57ddae6 100644 --- a/lib/scoring/winner_takes_all.rb +++ b/lib/scoring/winner_takes_all.rb @@ -1,13 +1,13 @@ module Scoring module WinnerTakesAll def self.stats_needed - return [] + return ["win"] end def self.score(match, interface) scores = {} match.players.each do |player| - scores[player.user_name] = score_user(match.win?(player)) + scores[player.user_name] = score_user(player.statistics.where(:match => match, :name => "win").value) end scores end -- cgit v1.2.3-2-g168b From b45ed282cb9b677d2973d7d25839f4cc60d738bd Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Mon, 28 Apr 2014 18:36:30 -0400 Subject: Fixing Manual --- lib/sampling/manual.html.erb | 13 ++++++++++++- lib/sampling/manual.rb | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/sampling/manual.html.erb b/lib/sampling/manual.html.erb index cf873b4..c9dd2fe 100644 --- a/lib/sampling/manual.html.erb +++ b/lib/sampling/manual.html.erb @@ -1 +1,12 @@ - +<% if @tournament.hosts.include? current_user %> + + <% @match.teams.each do |team| %> + <%= tag :input, {"type" => "radio", "name" => "winner", "value" => "#{team.id}" } %> + <%= "Team #{team.id} Won" %> + <% end %> + + <%= submit_tag("Finish match") %> + <%= @tournament.settings['ScoringMethod'] %> +<% else %> +

The match is running; the host has yet to post the scores of the match.

+<% end %> \ No newline at end of file diff --git a/lib/sampling/manual.rb b/lib/sampling/manual.rb index cfecd8f..1787cb7 100644 --- a/lib/sampling/manual.rb +++ b/lib/sampling/manual.rb @@ -31,6 +31,7 @@ module Sampling end def render_user_interaction(user) + @tournament = @match.tournament_stage.tournament @current_user = user @users = @match.users @stats = @match.stats_from(self.class) -- cgit v1.2.3-2-g168b From 55f4c94d089ce622bd4fe0b4c915e8e4cb4122aa Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Mon, 28 Apr 2014 19:32:32 -0400 Subject: changes to peer review and manual sampling --- lib/sampling/manual.html.erb | 11 +++++------ lib/sampling/manual.rb | 2 +- lib/sampling/peer_review.html.erb | 2 +- lib/sampling/peer_review.rb | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/sampling/manual.html.erb b/lib/sampling/manual.html.erb index c9dd2fe..7b71c29 100644 --- a/lib/sampling/manual.html.erb +++ b/lib/sampling/manual.html.erb @@ -1,12 +1,11 @@ -<% if @tournament.hosts.include? current_user %> - +<% if @tournament.hosts.include? @current_user %> + <% @match.teams.each do |team| %> - <%= tag :input, {"type" => "radio", "name" => "winner", "value" => "#{team.id}" } %> + <%= "Team #{team.id} Won" %> <% end %> - - <%= submit_tag("Finish match") %> - <%= @tournament.settings['ScoringMethod'] %> +
+ <% else %>

The match is running; the host has yet to post the scores of the match.

<% end %> \ No newline at end of file diff --git a/lib/sampling/manual.rb b/lib/sampling/manual.rb index 1787cb7..4e86925 100644 --- a/lib/sampling/manual.rb +++ b/lib/sampling/manual.rb @@ -40,7 +40,7 @@ module Sampling erb_filename = File.join(__FILE__.sub(/\.rb$/, '.html.erb')) erb = ERB.new(File.read(erb_filename)) erb.filename = erb_filename - return erb.result.html_safe + return erb.result(binding).html_safe end def handle_user_interaction(user, sampling_params) diff --git a/lib/sampling/peer_review.html.erb b/lib/sampling/peer_review.html.erb index e744936..a0b9c4d 100644 --- a/lib/sampling/peer_review.html.erb +++ b/lib/sampling/peer_review.html.erb @@ -18,7 +18,7 @@ <%# TODO: display more statistics %> <% end %> - <%= submit_tag("Submit peer evaluation", :onsubmit => "score_peers()") %> + <% else %>

Still waiting for peer feedback from the following users:

    <% @feedbacks_missing.each do |user| %> diff --git a/lib/sampling/peer_review.rb b/lib/sampling/peer_review.rb index e86595f..1aabe34 100644 --- a/lib/sampling/peer_review.rb +++ b/lib/sampling/peer_review.rb @@ -39,7 +39,7 @@ module Sampling erb_filename = File.join(__FILE__.sub(/\.rb$/, '.html.erb')) erb = ERB.new(File.read(erb_filename)) erb.filename = erb_filename - return erb.result.html_safe + return erb.result(binding).html_safe end def handle_user_interaction(reviewing_user, params) -- cgit v1.2.3-2-g168b