Commit d99cc225d46446e64aa19d7f6bb5b71b6f28da7b
1 parent
8fe27b82
Exists in
master
and in
1 other branch
recompute scores after voting
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
app/controllers/prompts_controller.rb
... | ... | @@ -60,10 +60,10 @@ class PromptsController < InheritedResources::Base |
60 | 60 | raise "need to specify either ':left' or ':right' as a direction" |
61 | 61 | end |
62 | 62 | |
63 | - | |
63 | + @prompt.choices.each {|c| c.score = c.compute_score; c.save!} | |
64 | 64 | respond_to do |format| |
65 | 65 | if successful |
66 | - format.xml { render :xml => @question.picked_prompt.to_xml(:methods => [:left_choice_text, :right_choice_text, :left_choice_id, :right_choice_id]), :status => :ok } | |
66 | + format.xml { render :xml => @question.picked_prompt.to_xml(:methods => [:left_choice_text, :right_choice_text, :left_choice_id, :right_choice_id]), :status => :ok } | |
67 | 67 | format.json { render :json => @question.picked_prompt.to_json(:methods => [:left_choice_text, :right_choice_text, :left_choice_id, :right_choice_id]), :status => :ok } |
68 | 68 | else |
69 | 69 | format.xml { render :xml => c, :status => :unprocessable_entity } | ... | ... |