Created
November 30, 2012 13:11
-
-
Save miry/4175666 to your computer and use it in GitHub Desktop.
Redmine backlogs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/models/rb_sprint_burndown.rb b/app/models/rb_sprint_burndown.rb | |
index d505f37..7027656 100644 | |
--- a/app/models/rb_sprint_burndown.rb | |
+++ b/app/models/rb_sprint_burndown.rb | |
@@ -43,19 +43,19 @@ class RbSprintBurndown < ActiveRecord::Base | |
@series ||= {} | |
key = "#{@direction}_#{remove_empty ? 'filled' : 'all'}" | |
if @series[key].nil? | |
- @series[key] = self.burndown[@direction].keys.collect{|k| k.to_s}.sort | |
+ @series[key] = self.burndown.nil? ? [] : self.burndown[@direction].keys.collect{|k| k.to_s}.sort | |
if remove_empty | |
# delete :points_committed if flatline | |
- @series[key].delete('points_committed') if self.burndown[@direction][:points_committed].uniq.compact.size < 1 | |
+ @series[key].delete('points_committed') if self.burndown && self.burndown[@direction][:points_committed].uniq.compact.size < 1 | |
# delete any series that is flat-line 0/nil | |
@series[key].each {|k| | |
- @series[key].delete(k) if k != 'points_committed' && self.burndown[@direction][k.intern].collect{|d| d.to_f }.uniq == [0.0] | |
+ @series[key].delete(k) if k != 'points_committed' && self.burndown && self.burndown[@direction][k.intern].collect{|d| d.to_f }.uniq == [0.0] | |
} | |
end | |
end | |
- return @series[key] | |
+ return @series[key] || {} | |
end | |
#compatibility | |
@@ -66,7 +66,7 @@ class RbSprintBurndown < ActiveRecord::Base | |
def data | |
self.recalculate! | |
- return self.burndown[@direction] | |
+ return self.burndown.nil? ? {} : self.burndown[@direction] | |
end | |
def set_defaults |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment