Commit ca2a2340af3255eb005b0c3540bfb9f4c9c06781

Authored by Luke Baker
1 parent 9f8f7b6c

fix bug in user_generated_ideas over time response

CHANGELOG.md
  1 + * Fix bug in response user_generated_ideas totals over time, where the min and max dates were getting added as strings instead of date objects
1 2 * Update choices to act_as_versioned
2 3  
3 4 ## Pairwise 3.0.1 (Apr 16, 2012) ###
... ...
app/controllers/questions_controller.rb
... ... @@ -250,8 +250,8 @@ class QuestionsController < InheritedResources::Base
250 250 data = Choice.count(:conditions => "choices.question_id = #{@question.id} AND choices.creator_id <> #{@question.creator_id}",
251 251 :group => "date(choices.created_at)")
252 252 # we want graphs to go from date of first vote -> date of last vote, so adding those two boundries here.
253   - mindate = Vote.minimum('date(created_at)', :conditions => {:question_id => @question.id})
254   - maxdate = Vote.maximum('date(created_at)', :conditions => {:question_id => @question.id})
  253 + mindate = Vote.minimum('date(created_at)', :conditions => {:question_id => @question.id}).to_date
  254 + maxdate = Vote.maximum('date(created_at)', :conditions => {:question_id => @question.id}).to_date
255 255  
256 256 data[mindate] = 0 if !data.include?(mindate) && !mindate.nil?
257 257 data[maxdate] = 0 if !data.include?(maxdate) && !maxdate.nil?
... ...