From d99cc225d46446e64aa19d7f6bb5b71b6f28da7b Mon Sep 17 00:00:00 2001 From: Pius Uzamere Date: Thu, 3 Dec 2009 21:40:53 -0500 Subject: [PATCH] recompute scores after voting --- app/controllers/prompts_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/prompts_controller.rb b/app/controllers/prompts_controller.rb index de758ff..b0ae0aa 100644 --- a/app/controllers/prompts_controller.rb +++ b/app/controllers/prompts_controller.rb @@ -60,10 +60,10 @@ class PromptsController < InheritedResources::Base raise "need to specify either ':left' or ':right' as a direction" end - + @prompt.choices.each {|c| c.score = c.compute_score; c.save!} respond_to do |format| if successful - format.xml { render :xml => @question.picked_prompt.to_xml(:methods => [:left_choice_text, :right_choice_text, :left_choice_id, :right_choice_id]), :status => :ok } + format.xml { render :xml => @question.picked_prompt.to_xml(:methods => [:left_choice_text, :right_choice_text, :left_choice_id, :right_choice_id]), :status => :ok } format.json { render :json => @question.picked_prompt.to_json(:methods => [:left_choice_text, :right_choice_text, :left_choice_id, :right_choice_id]), :status => :ok } else format.xml { render :xml => c, :status => :unprocessable_entity } -- libgit2 0.21.2