diff --git a/app/controllers/choices_controller.rb b/app/controllers/choices_controller.rb index d3028eb..d02d857 100644 --- a/app/controllers/choices_controller.rb +++ b/app/controllers/choices_controller.rb @@ -10,7 +10,7 @@ class ChoicesController < InheritedResources::Base @choices = Choice.find(:all, :conditions => {:question_id => @question.id}, :limit => params[:limit].to_i, :order => 'score DESC') else @question = Question.find(params[:question_id], :include => :choices) #eagerloads ALL choices - @choices = @question.choices(true)#.sort_by {|c| 0 - c.score } + @choices = @question.choices(true) end index! do |format| format.xml { render :xml => params[:data].blank? ? @choices.to_xml(:methods => [:item_data, :votes_count]) : @choices.to_xml(:include => [:items], :methods => [:data, :votes_count])} diff --git a/app/models/choice.rb b/app/models/choice.rb index d202f4d..5c73aea 100644 --- a/app/models/choice.rb +++ b/app/models/choice.rb @@ -44,7 +44,7 @@ class Choice < ActiveRecord::Base def compute_score if wins_plus_losses == 0 - raise 'wtfbbq'#return 0 + return 0 else (wins.to_f / wins_plus_losses ) * 100 end -- libgit2 0.21.2