Permalink
Browse files

fix bug in user_generated_ideas over time response

  • Loading branch information...
1 parent 9f8f7b6 commit ca2a2340af3255eb005b0c3540bfb9f4c9c06781 @lukebaker lukebaker committed Jun 7, 2012
Showing with 3 additions and 2 deletions.
  1. +1 −0 CHANGELOG.md
  2. +2 −2 app/controllers/questions_controller.rb
View
@@ -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) ###
@@ -250,8 +250,8 @@ def object_info_totals_by_date
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?

0 comments on commit ca2a234

Please sign in to comment.