Commit 8fe27b82e7c7d873affb1033e84e2e058277efa3

Authored by Pius Uzamere
1 parent 08b60c1f

recompute score after vote is recorded

Showing 1 changed file with 1 additions and 0 deletions   Show diff stats
app/models/user.rb
... ... @@ -32,6 +32,7 @@ class User < ActiveRecord::Base
32 32 def record_vote(visitor_identifier, prompt, ordinality)
33 33 visitor = visitors.find_or_create_by_identifier(visitor_identifier)
34 34 visitor.vote_for!(prompt, ordinality)
  35 + prompt.choices.each {|c| c.score = c.compute_score; c.save!}
35 36 end
36 37  
37 38 def record_skip(visitor_identifier, prompt)
... ...