Commit 08b60c1f4267da3c36872aada12d8ef0db401b55

Authored by Pius Uzamere
1 parent 10acec7a

save before computing score

Showing 1 changed file with 1 additions and 0 deletions   Show diff stats
app/models/visitor.rb
@@ -16,6 +16,7 @@ class Visitor < ActiveRecord::Base @@ -16,6 +16,7 @@ class Visitor < ActiveRecord::Base
16 choice = prompt.choices[ordinality] #we need to guarantee that the choices are in the right order (by position) 16 choice = prompt.choices[ordinality] #we need to guarantee that the choices are in the right order (by position)
17 prompt_vote = votes.create!(:voteable => prompt) 17 prompt_vote = votes.create!(:voteable => prompt)
18 choice_vote = votes.create!(:voteable => choice) 18 choice_vote = votes.create!(:voteable => choice)
  19 + choice.save!
19 choice.score = choice.compute_score 20 choice.score = choice.compute_score
20 choice.save! 21 choice.save!
21 end 22 end