Class: DailyWipByBlockedStalledChart

Inherits:
DailyWipChart show all
Defined in:
lib/jirametrics/daily_wip_by_blocked_stalled_chart.rb

Constant Summary

Constants inherited from ChartBase

ChartBase::LABEL_POSITIONS, ChartBase::OKABE_ITO_PALETTE

Instance Attribute Summary

Attributes inherited from DailyWipChart

#possible_statuses

Attributes inherited from ChartBase

#aggregated_project, #all_boards, #atlassian_document_format, #board_id, #canvas_height, #canvas_width, #data_quality, #date_range, #file_system, #fix_versions, #holiday_dates, #issues, #settings, #time_range, #timezone_offset, #x_axis_title, #y_axis_title

Instance Method Summary collapse

Methods inherited from DailyWipChart

#active_dates_for, #add_trend_line, #background_color_for, #build_data_sets, #configure_rule, #conflicting_labels, #daily_wip_totals, #datapoint_for, #group_issues_by_active_dates, #grouping_rules, #initialize, #issue_strings_for, #make_data_set, #prepend_trend_lines, #run, #select_possible_rules, #trend_line_data_set

Methods inherited from ChartBase

#aggregated_project?, #before_run, #call_before_run, #canvas, #canvas_responsive?, #chart_format, #collapsible_issues_panel, #color_block, #color_for, #completed_issues_in_range, #current_board, #cycletime, #cycletime_for_issue, #daily_chart_dataset, #date_annotation, #describe_non_working_days, #description_text, #format_integer, #format_status, #header_text, #holidays, #html_directory, #icon_span, #initialize, #link_to_issue, #next_id, #non_working_day?, #normalize_annotation_datetime, #not_visible_icon, #not_visible_text, #random_color, #render, #render_axis_title, #render_top_text, #resolve_status, #stagger_label_positions, #status_category_color, #to_human_readable, #working_days_annotation, #wrap_and_render

Constructor Details

This class inherits a constructor from DailyWipChart

Instance Method Details

#assign_group_rule(rules, started:, stopped_today:, change:, days:) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/jirametrics/daily_wip_by_blocked_stalled_chart.rb', line 64

def assign_group_rule rules, started:, stopped_today:, change:, days:
  if stopped_today && started.nil?
    @has_completed_but_not_started = true
    rules.label = 'Completed but not started'
    rules.color = '--wip-chart-completed-but-not-started-color'
    rules.group_priority = -1
    rules.issue_hint = '(Cycle time: Unknown)'
  elsif stopped_today
    rules.label = 'Completed'
    rules.color = '--wip-chart-completed-color'
    rules.group_priority = -2
    rules.issue_hint = "(Cycle time: #{label_days days})"
  elsif started.nil?
    rules.label = 'Start date unknown'
    rules.color = '--body-background'
    rules.group_priority = 4
  else
    assign_in_progress_group_rule(rules, change: change, days: days)
  end
end

#assign_in_progress_group_rule(rules, change:, days:) ⇒ Object

A started, not-yet-completed issue is grouped by its blocked/stalled state on the day.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/jirametrics/daily_wip_by_blocked_stalled_chart.rb', line 86

def assign_in_progress_group_rule rules, change:, days:
  if change&.blocked?
    rules.label = 'Blocked'
    rules.color = '--blocked-color'
    rules.group_priority = 1
    rules.issue_hint = "(Age: #{label_days days}, #{change.reasons})"
  elsif change&.stalled?
    rules.label = 'Stalled'
    rules.color = '--stalled-color'
    rules.group_priority = 2
    rules.issue_hint = "(Age: #{label_days days}, #{change.reasons})"
  else
    rules.label = 'Active'
    rules.color = '--wip-chart-active-color'
    rules.group_priority = 3
    rules.issue_hint = "(Age: #{label_days days})"
  end
end

#days_between(started_date, stopped_date) ⇒ Object

The issue's cycle time when it has finished, its current age when it's still going, or nil when we don't even know when it started.



57
58
59
60
61
62
# File 'lib/jirametrics/daily_wip_by_blocked_stalled_chart.rb', line 57

def days_between started_date, stopped_date
  return (stopped_date - started_date).to_i + 1 if started_date && stopped_date
  return (time_range.end.to_date - started_date).to_i + 1 if started_date

  nil
end

#default_description_textObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/jirametrics/daily_wip_by_blocked_stalled_chart.rb', line 10

def default_description_text
  <<-HTML
    <div class="p">
      This chart highlights work that is #{color_block '--blocked-color'} blocked,
      #{color_block '--stalled-color'} stalled, or
      #{color_block '--wip-chart-active-color'} active on each given day.
      <ul>
        <li>#{color_block '--blocked-color'} Blocked could mean that the item has been flagged or it's
          in a status that is configured as blocked, or it could have a link showing that it is blocked
        by another item. It all depends how the report has been configured.</li>
        <li>#{color_block '--stalled-color'} Stalled indicates that there has been no activity on this
        item in five days.</li>
      </ul>
    </div>
    <div class="p">
      Note that if an item tracks as both blocked and stalled, it will only show up in the blocked totals.
      It will not be double counted.
    </div>
    <% if @has_completed_but_not_started %>
    <div class="p">
      #{color_block '--wip-chart-completed-but-not-started-color'} "Completed but not started"
      reflects the fact that while we know that it completed that day, we were unable to determine when
      it had started; it had moved directly from a To Do status to a Done status.
      The #{color_block '--body-background'} shading at the top shows when they might
      have been active. Note that the this grouping is approximate as we just don't know for sure.
    </div>
    <% end %>
    #{describe_non_working_days}
  HTML
end

#default_grouping_rules(issue:, rules:) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/jirametrics/daily_wip_by_blocked_stalled_chart.rb', line 41

def default_grouping_rules issue:, rules:
  started, stopped = issue.started_stopped_times
  started_date = started&.to_date
  stopped_date = stopped&.to_date

  date = rules.current_date
  change = issue.blocked_stalled_by_date(date_range: date..date, chart_end_time: time_range.end)[date]

  assign_group_rule(
    rules, started: started, stopped_today: stopped_date == date, change: change,
    days: days_between(started_date, stopped_date)
  )
end

#default_header_textObject



6
7
8
# File 'lib/jirametrics/daily_wip_by_blocked_stalled_chart.rb', line 6

def default_header_text
  'Daily WIP, grouped by Blocked and Stalled statuses'
end