Commit 60b1c52e4081cde9929f8688261d8e74f556b82e

Authored by Pius Uzamere
1 parent afbf3224

real logging, spike removed

Showing 1 changed file with 4 additions and 5 deletions   Show diff stats
app/models/visitor.rb
@@ -13,18 +13,17 @@ class Visitor < ActiveRecord::Base @@ -13,18 +13,17 @@ class Visitor < ActiveRecord::Base
13 end 13 end
14 14
15 def vote_for!(prompt, ordinality) 15 def vote_for!(prompt, ordinality)
16 - logger.info 'testing'  
17 choices = prompt.choices 16 choices = prompt.choices
18 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)
19 prompt_vote = votes.create!(:voteable => prompt) 18 prompt_vote = votes.create!(:voteable => prompt)
20 - puts "Visitor: #{self.inspect} voted for Prompt: #{prompt.inspect}" 19 + logger.info "Visitor: #{self.inspect} voted for Prompt: #{prompt.inspect}"
21 choice_vote = votes.create!(:voteable => choice) 20 choice_vote = votes.create!(:voteable => choice)
22 - puts "Visitor: #{self.inspect} voted for Choice: #{choice.inspect}" 21 + logger.info "Visitor: #{self.inspect} voted for Choice: #{choice.inspect}"
23 choice.save! 22 choice.save!
24 choice.score = choice.compute_score 23 choice.score = choice.compute_score
25 - puts "Just computed the score for that choice and it's apparently #{choice.score}" 24 + logger.info "Just computed the score for that choice and it's apparently #{choice.score}"
26 choice.save! 25 choice.save!
27 - puts "Saved. That choice's score is still #{choice.score}" 26 + logger.info "Saved. That choice's score is still #{choice.score}"
28 other_choices = choices - [choice] 27 other_choices = choices - [choice]
29 other_choices.each {|c| c.lose! } 28 other_choices.each {|c| c.lose! }
30 end 29 end