From ca2a2340af3255eb005b0c3540bfb9f4c9c06781 Mon Sep 17 00:00:00 2001 From: Luke Baker Date: Thu, 7 Jun 2012 11:35:34 -0400 Subject: [PATCH] fix bug in user_generated_ideas over time response --- CHANGELOG.md | 1 + app/controllers/questions_controller.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 471ea5f..ad97d0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ + * 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 * Update choices to act_as_versioned ## Pairwise 3.0.1 (Apr 16, 2012) ### diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index 2ad3caf..b7aec21 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -250,8 +250,8 @@ class QuestionsController < InheritedResources::Base data = Choice.count(:conditions => "choices.question_id = #{@question.id} AND choices.creator_id <> #{@question.creator_id}", :group => "date(choices.created_at)") # we want graphs to go from date of first vote -> date of last vote, so adding those two boundries here. - mindate = Vote.minimum('date(created_at)', :conditions => {:question_id => @question.id}) - maxdate = Vote.maximum('date(created_at)', :conditions => {:question_id => @question.id}) + mindate = Vote.minimum('date(created_at)', :conditions => {:question_id => @question.id}).to_date + maxdate = Vote.maximum('date(created_at)', :conditions => {:question_id => @question.id}).to_date data[mindate] = 0 if !data.include?(mindate) && !mindate.nil? data[maxdate] = 0 if !data.include?(maxdate) && !maxdate.nil? -- libgit2 0.21.2