Commit cb57414ef6b3fc4f12ac8959dd0201a491ace35e

Authored by Luke Baker
1 parent fb77b15c

don't add min/max date if nil

Showing 1 changed file with 2 additions and 2 deletions   Show diff stats
app/controllers/questions_controller.rb
... ... @@ -222,8 +222,8 @@ class QuestionsController < InheritedResources::Base
222 222 mindate = Vote.minimum('date(created_at)', :conditions => {:question_id => @question.id})
223 223 maxdate = Vote.maximum('date(created_at)', :conditions => {:question_id => @question.id})
224 224  
225   - data[mindate] = 0 if !data.include?(mindate)
226   - data[maxdate] = 0 if !data.include?(maxdate)
  225 + data[mindate] = 0 if !data.include?(mindate) && !mindate.nil?
  226 + data[maxdate] = 0 if !data.include?(maxdate) && !maxdate.nil?
227 227 elsif object_type == 'user_sessions'
228 228 # little more work to do here:
229 229 result = Vote.find(:all, :select => 'date(created_at) as date, voter_id, count(*) as vote_count',
... ...