Commit 7f62cf5ad84814cd6353cad05a0635b1f22289a2
1 parent
720aa9e1
Exists in
master
and in
1 other branch
additional logging
Showing
1 changed file
with
4 additions
and
1 deletions
Show diff stats
app/models/visitor.rb
| @@ -16,11 +16,14 @@ class Visitor < ActiveRecord::Base | @@ -16,11 +16,14 @@ class Visitor < ActiveRecord::Base | ||
| 16 | choices = prompt.choices | 16 | choices = prompt.choices |
| 17 | choice = choices[ordinality] #we need to guarantee that the choices are in the right order (by position) | 17 | choice = choices[ordinality] #we need to guarantee that the choices are in the right order (by position) |
| 18 | prompt_vote = votes.create!(:voteable => prompt) | 18 | prompt_vote = votes.create!(:voteable => prompt) |
| 19 | + puts "Visitor: #{self.inspect} voted for Prompt: #{prompt.inspect}" | ||
| 19 | choice_vote = votes.create!(:voteable => choice) | 20 | choice_vote = votes.create!(:voteable => choice) |
| 21 | + puts "Visitor: #{self.inspect} voted for Choice: #{choice.inspect}" | ||
| 20 | choice.save! | 22 | choice.save! |
| 21 | choice.score = choice.compute_score | 23 | choice.score = choice.compute_score |
| 24 | + puts "Just computed the score for that choice and it's apparently #{choice.score}" | ||
| 22 | choice.save! | 25 | choice.save! |
| 23 | - | 26 | + puts "Saved. That choice's score is still #{choice.score}" |
| 24 | other_choices = choices - [choice] | 27 | other_choices = choices - [choice] |
| 25 | other_choices.each {|c| c.lose! } | 28 | other_choices.each {|c| c.lose! } |
| 26 | end | 29 | end |