Commit cb57414ef6b3fc4f12ac8959dd0201a491ace35e
1 parent
fb77b15c
Exists in
master
and in
1 other branch
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,8 +222,8 @@ class QuestionsController < InheritedResources::Base | ||
222 | mindate = Vote.minimum('date(created_at)', :conditions => {:question_id => @question.id}) | 222 | mindate = Vote.minimum('date(created_at)', :conditions => {:question_id => @question.id}) |
223 | maxdate = Vote.maximum('date(created_at)', :conditions => {:question_id => @question.id}) | 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 | elsif object_type == 'user_sessions' | 227 | elsif object_type == 'user_sessions' |
228 | # little more work to do here: | 228 | # little more work to do here: |
229 | result = Vote.find(:all, :select => 'date(created_at) as date, voter_id, count(*) as vote_count', | 229 | result = Vote.find(:all, :select => 'date(created_at) as date, voter_id, count(*) as vote_count', |