The controller threw an error when a start date was not defined because it was

trying to format the string.  In the generate method, we already have logic to
return nil if the start date is not defined, so I added a check in the fetch
method to return nil if the generate method exited with a nil status.
pull/6827/head
Nate Lowrie 15 years ago
parent c320300823
commit 9f971841a7
  1. 6
      app/models/backlog_chart_data.rb

@ -28,8 +28,10 @@ class BacklogChartData < ActiveRecord::Base
def self.fetch(options = {})
backlog = Backlog.find(options[:backlog_id])
generate backlog
end_date = backlog.end_date || 30.days.from_now.to_date
if generate(backlog).nil?
return nil
end
end_date = backlog.end_date
data = find_all_by_backlog_id backlog.id, :conditions => ["created_at>=? AND created_at<=?", backlog.start_date.to_formatted_s(:db), end_date.to_formatted_s(:db)], :order => "created_at ASC"
return nil if data.nil? || data.length==0

Loading…
Cancel
Save