Commit 7f62cf5ad84814cd6353cad05a0635b1f22289a2

Authored by Pius Uzamere
1 parent 720aa9e1

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 16 choices = prompt.choices
17 17 choice = choices[ordinality] #we need to guarantee that the choices are in the right order (by position)
18 18 prompt_vote = votes.create!(:voteable => prompt)
  19 + puts "Visitor: #{self.inspect} voted for Prompt: #{prompt.inspect}"
19 20 choice_vote = votes.create!(:voteable => choice)
  21 + puts "Visitor: #{self.inspect} voted for Choice: #{choice.inspect}"
20 22 choice.save!
21 23 choice.score = choice.compute_score
  24 + puts "Just computed the score for that choice and it's apparently #{choice.score}"
22 25 choice.save!
23   -
  26 + puts "Saved. That choice's score is still #{choice.score}"
24 27 other_choices = choices - [choice]
25 28 other_choices.each {|c| c.lose! }
26 29 end
... ...