summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornfoy <nfoy@purdue.edu>2014-04-28 21:32:09 -0400
committernfoy <nfoy@purdue.edu>2014-04-28 21:32:09 -0400
commitd52ceaf8d2b823b68edcf3614999b8639a0971f9 (patch)
treebdb969dbad788cb7e63665bf502c754765286db6
parent819fd70c1285bf5670b68842adad8c77c36d1076 (diff)
parent7410df080be95211daa2e97b8a57faa8aa903b0a (diff)
Merge branch 'master' of https://github.com/LukeShu/leaguer
-rw-r--r--app/models/match.rb4
-rw-r--r--app/views/matches/show.html.erb2
-rw-r--r--lib/sampling/manual.html.erb2
-rw-r--r--lib/sampling/manual.rb5
4 files changed, 8 insertions, 5 deletions
diff --git a/app/models/match.rb b/app/models/match.rb
index 57b7d36..85084f5 100644
--- a/app/models/match.rb
+++ b/app/models/match.rb
@@ -7,8 +7,8 @@ class Match < ActiveRecord::Base
def finished?
ok = true
- tournament_stage.scoring_method.stats_needed.each do |stat|
- ok &= statistics.where(match: self, name: stat).nil?
+ tournament_stage.scoring.stats_needed.each do |stat|
+ ok &= !statistics.where(match: self, name: stat).nil?
end
ok
end
diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb
index 01484d3..bf5518f 100644
--- a/app/views/matches/show.html.erb
+++ b/app/views/matches/show.html.erb
@@ -5,7 +5,7 @@
</p>
<p>
<strong>Tournament stage:</strong>
- <%= @match.tournament_stage %>
+ <%= @tournament.stages.order(:id).index(@match.tournament_stage)+1 %>
</p>
<%#
diff --git a/lib/sampling/manual.html.erb b/lib/sampling/manual.html.erb
index b783506..187f002 100644
--- a/lib/sampling/manual.html.erb
+++ b/lib/sampling/manual.html.erb
@@ -2,7 +2,7 @@
<input type="hidden" name="update_action" value="finish" >
<% @match.teams.each do |team| %>
<label>
- <input type="radio", name="winner", value="<%= team.id %>" >
+ <input type="radio", name="win", value="<%= team.id %>" >
<%= "Team #{team.id} Won" %>
</label>
<% end %>
diff --git a/lib/sampling/manual.rb b/lib/sampling/manual.rb
index 4e86925..01f6835 100644
--- a/lib/sampling/manual.rb
+++ b/lib/sampling/manual.rb
@@ -44,7 +44,10 @@ module Sampling
end
def handle_user_interaction(user, sampling_params)
- # TODO
+ # => Save sampling_params as statistics
+ sampling_params.select {|name, value| @match.stats_from(self.class).include? name }.each do |name, value|
+ Statistic.create(name: value, user: user, match: @match)
+ end
end
end
end