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

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

#add_trend_line, #configure_rule, #group_issues_by_active_dates, #grouping_rules, #initialize, #make_data_set, #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, #label_days, #label_hours, #label_issues, #label_minutes, #link_to_issue, #next_id, #normalize_annotation_datetime, #not_visible_text, #random_color, #render, #render_axis_title, #render_top_text, #seam_end, #seam_start, #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

#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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/jirametrics/daily_wip_by_blocked_stalled_chart.rb', line 41

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

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

  days = nil
  if started_date && stopped_date
    days = (stopped_date - started_date).to_i + 1 # cycletime
  elsif started_date
    days = (time_range.end.to_date - started_date).to_i + 1 # age
  end

  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
  elsif 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

#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