Commit 229ad2fe2c822fcabf8d67af31150a36f0437daf

Authored by Pius Uzamere
1 parent 46688500

improved logging

Showing 1 changed file with 2 additions and 1 deletions   Show diff stats
app/models/question.rb
@@ -27,11 +27,12 @@ class Question < ActiveRecord::Base @@ -27,11 +27,12 @@ class Question < ActiveRecord::Base
27 #TODO: generalize for prompts of rank > 2 27 #TODO: generalize for prompts of rank > 2
28 #TODO: add index for rapid finding 28 #TODO: add index for rapid finding
29 def picked_prompt(rank = 2) 29 def picked_prompt(rank = 2)
  30 + logger.info "inside Question#picked_prompt"
30 raise NotImplementedError.new("Sorry, we currently only support pairwise prompts. Rank of the prompt must be 2.") unless rank == 2 31 raise NotImplementedError.new("Sorry, we currently only support pairwise prompts. Rank of the prompt must be 2.") unless rank == 2
31 begin 32 begin
32 choice_id_array = distinct_array_of_choice_ids(rank) 33 choice_id_array = distinct_array_of_choice_ids(rank)
33 @p ||= prompts.find_or_create_by_left_choice_id_and_right_choice_id(choice_id_array[0], choice_id_array[1], :include => [{ :left_choice => :item }, { :right_choice => :item }]) 34 @p ||= prompts.find_or_create_by_left_choice_id_and_right_choice_id(choice_id_array[0], choice_id_array[1], :include => [{ :left_choice => :item }, { :right_choice => :item }])
34 - puts "#{@p.inspect} is active? #{@p.active?}" 35 + logger.info "#{@p.inspect} is active? #{@p.active?}"
35 end until @p.active? 36 end until @p.active?
36 return @p 37 return @p
37 end 38 end