Commit 7e22d490392d84c58e6a15d3a6e43e4a4ca4c32c
1 parent
d9a98556
Exists in
master
and in
1 other branch
spike removed
Showing
2 changed files
with
2 additions
and
2 deletions
Show diff stats
app/controllers/choices_controller.rb
@@ -10,7 +10,7 @@ class ChoicesController < InheritedResources::Base | @@ -10,7 +10,7 @@ class ChoicesController < InheritedResources::Base | ||
10 | @choices = Choice.find(:all, :conditions => {:question_id => @question.id}, :limit => params[:limit].to_i, :order => 'score DESC') | 10 | @choices = Choice.find(:all, :conditions => {:question_id => @question.id}, :limit => params[:limit].to_i, :order => 'score DESC') |
11 | else | 11 | else |
12 | @question = Question.find(params[:question_id], :include => :choices) #eagerloads ALL choices | 12 | @question = Question.find(params[:question_id], :include => :choices) #eagerloads ALL choices |
13 | - @choices = @question.choices(true)#.sort_by {|c| 0 - c.score } | 13 | + @choices = @question.choices(true) |
14 | end | 14 | end |
15 | index! do |format| | 15 | index! do |format| |
16 | format.xml { render :xml => params[:data].blank? ? @choices.to_xml(:methods => [:item_data, :votes_count]) : @choices.to_xml(:include => [:items], :methods => [:data, :votes_count])} | 16 | format.xml { render :xml => params[:data].blank? ? @choices.to_xml(:methods => [:item_data, :votes_count]) : @choices.to_xml(:include => [:items], :methods => [:data, :votes_count])} |
app/models/choice.rb
@@ -44,7 +44,7 @@ class Choice < ActiveRecord::Base | @@ -44,7 +44,7 @@ class Choice < ActiveRecord::Base | ||
44 | 44 | ||
45 | def compute_score | 45 | def compute_score |
46 | if wins_plus_losses == 0 | 46 | if wins_plus_losses == 0 |
47 | - raise 'wtfbbq'#return 0 | 47 | + return 0 |
48 | else | 48 | else |
49 | (wins.to_f / wins_plus_losses ) * 100 | 49 | (wins.to_f / wins_plus_losses ) * 100 |
50 | end | 50 | end |