Commit 7e22d490392d84c58e6a15d3a6e43e4a4ca4c32c

Authored by Pius Uzamere
1 parent d9a98556

spike removed

app/controllers/choices_controller.rb
... ... @@ -10,7 +10,7 @@ class ChoicesController < InheritedResources::Base
10 10 @choices = Choice.find(:all, :conditions => {:question_id => @question.id}, :limit => params[:limit].to_i, :order => 'score DESC')
11 11 else
12 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 14 end
15 15 index! do |format|
16 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 44  
45 45 def compute_score
46 46 if wins_plus_losses == 0
47   - raise 'wtfbbq'#return 0
  47 + return 0
48 48 else
49 49 (wins.to_f / wins_plus_losses ) * 100
50 50 end
... ...