Only make the starts-at-0 assumption when we can't do an actual measurement

pull/6827/head
friflaj 15 years ago
parent 6129a93389
commit 6e01b8d59e
  1. 6
      app/models/sprint.rb

@ -44,11 +44,13 @@ class Burndown
# calculate first day if not loaded from cache
if !_series[0]
assume = (days[0] != Date.today)
backlog ||= sprint.stories
_series[0] = [
backlog.inject(0) {|sum, story| sum + story.story_points.to_f }, # committed
0, # resolved
0, # accepted
(assume ? 0 : backlog.select {|s| s.done_ratio == 100 }.inject(0) {|sum, story| sum + story.story_points.to_f }),
(assume ? 0 : backlog.select {|s| s.closed? }.inject(0) {|sum, story| sum + story.story_points.to_f }),
backlog.inject(0) {|sum, story| sum + story.estimated_hours.to_f } # remaining
]
cache(days[0], _series[0])

Loading…
Cancel
Save