Commit 0be5d2e8509ddb291e0fa001d52b32c73d64b8bb
1 parent
d3e18f7a
Exists in
master
and in
1 other branch
always recompute scores before showing results
Showing
1 changed file
with
1 additions
and
0 deletions
Show diff stats
app/controllers/choices_controller.rb
@@ -13,6 +13,7 @@ class ChoicesController < InheritedResources::Base | @@ -13,6 +13,7 @@ class ChoicesController < InheritedResources::Base | ||
13 | else | 13 | else |
14 | @question = Question.find(params[:question_id], :include => :choices) #eagerloads ALL choices | 14 | @question = Question.find(params[:question_id], :include => :choices) #eagerloads ALL choices |
15 | @choices = @question.choices(true) | 15 | @choices = @question.choices(true) |
16 | + @choices.each {|c| c.compute_score!} | ||
16 | end | 17 | end |
17 | index! do |format| | 18 | index! do |format| |
18 | format.xml { render :xml => params[:data].blank? ? @choices.to_xml(:methods => [:item_data, :votes_count]) : @choices.to_xml(:include => [:items], :methods => [:data, :votes_count])} | 19 | format.xml { render :xml => params[:data].blank? ? @choices.to_xml(:methods => [:item_data, :votes_count]) : @choices.to_xml(:include => [:items], :methods => [:data, :votes_count])} |