Class: SprintPointsMeasure

Inherits:
Object
  • Object
show all
Defined in:
lib/jirametrics/sprint_points_measure.rb

Overview

The story-points view of a sprint burndown: a running total of estimate as issues enter, leave, complete, or have their points changed. It plugs into SprintBurndown#build_sprint_data_set, which shares its loop with the story-count view (SprintCountMeasure).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSprintPointsMeasure

Returns a new instance of SprintPointsMeasure.



9
10
11
12
13
14
# File 'lib/jirametrics/sprint_points_measure.rb', line 9

def initialize
  @summary_stats = SprintSummaryStats.new
  @summary_stats.completed = 0.0
  @estimate = 0.0
  @issues_currently_in_sprint = []
end

Instance Attribute Details

#summary_statsObject (readonly)

Returns the value of attribute summary_stats.



7
8
9
# File 'lib/jirametrics/sprint_points_measure.rb', line 7

def summary_stats
  @summary_stats
end

Instance Method Details

#active_titleObject



61
# File 'lib/jirametrics/sprint_points_measure.rb', line 61

def active_title = "Sprint still active. #{@estimate} points still in progress."

#ended_titleObject



60
# File 'lib/jirametrics/sprint_points_measure.rb', line 60

def ended_title = "Sprint ended with #{@estimate} points unfinished"

#points_label(estimate) ⇒ Object



55
56
57
# File 'lib/jirametrics/sprint_points_measure.rb', line 55

def points_label estimate
  "#{estimate || 'no'} points"
end

#record(change_data) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/jirametrics/sprint_points_measure.rb', line 31

def record change_data
  case change_data.action
  when :story_points
    return nil unless @issues_currently_in_sprint.include? change_data.issue.key

    @summary_stats.points_values_changed = true
    old_estimate = change_data.estimate - change_data.value
    "Story points changed from #{old_estimate} points to #{change_data.estimate} points"
  when :enter_sprint
    @summary_stats.added += change_data.estimate
    "Added to sprint with #{points_label change_data.estimate}"
  when :issue_stopped
    @estimate -= change_data.estimate
    @issues_currently_in_sprint.delete change_data.issue.key
    @summary_stats.completed += change_data.estimate
    "Completed with #{points_label change_data.estimate}"
  when :leave_sprint
    @summary_stats.removed += change_data.estimate
    "Removed from sprint with #{points_label change_data.estimate}"
  else
    raise "Unexpected action: #{change_data.action}"
  end
end

#started_titleObject



59
# File 'lib/jirametrics/sprint_points_measure.rb', line 59

def started_title = "Sprint started with #{@estimate} points"

#update_state(change_data) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/jirametrics/sprint_points_measure.rb', line 18

def update_state change_data
  case change_data.action
  when :enter_sprint
    @issues_currently_in_sprint << change_data.issue.key
    @estimate += change_data.estimate
  when :leave_sprint
    @issues_currently_in_sprint.delete change_data.issue.key
    @estimate -= change_data.estimate
  when :story_points
    @estimate += change_data.value if @issues_currently_in_sprint.include? change_data.issue.key
  end
end

#valueObject



16
# File 'lib/jirametrics/sprint_points_measure.rb', line 16

def value = @estimate