Class: DailyWipByBlockedStalledChart

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

Instance Attribute Summary

Attributes inherited from DailyWipChart

#possible_statuses

Attributes inherited from ChartBase

#aggregated_project, #all_boards, #board_id, #canvas_height, #canvas_width, #data_quality, #date_range, #holiday_dates, #issues, #settings, #time_range, #timezone_offset

Instance Method Summary collapse

Methods inherited from DailyWipChart

#configure_rule, #group_issues_by_active_dates, #grouping_rules, #initialize, #make_data_set, #run, #select_possible_rules

Methods inherited from ChartBase

#aggregated_project?, #canvas, #canvas_responsive?, #chart_format, #collapsible_issues_panel, #color_for, #completed_issues_in_range, #current_board, #daily_chart_dataset, #description_text, #filter_issues, #format_integer, #format_status, #header_text, #holidays, #initialize, #label_days, #label_issues, #link_to_issue, #next_id, #random_color, #render, #sprints_in_time_range, #status_category_color, #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
# File 'lib/jirametrics/daily_wip_by_blocked_stalled_chart.rb', line 10

def default_description_text
  <<-HTML
    <p>
      This chart highlights work that is blocked or stalled on each given day. In Jira terms, blocked
      means that the issue has been "flagged". Stalled indicates that the item hasn't had any updates in 5 days.
    </p>
    <p>
      Note that if an item tracks as both blocked and stalled, it will only show up in the flagged totals.
      It will not be double counted.
    </p>
    <p>
      The white section reflects items that have stopped but for which we can't identify the start date. As
      a result, we are unable to properly show the WIP for these items.
    </p>
  HTML
end

#default_grouping_rules(issue:, rules:) ⇒ Object



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
# File 'lib/jirametrics/daily_wip_by_blocked_stalled_chart.rb', line 42

def default_grouping_rules issue:, rules:
  started = issue.board.cycletime.started_time(issue)
  stopped_date = issue.board.cycletime.stopped_time(issue)&.to_date
  change = key_blocked_stalled_change issue: issue, date: rules.current_date, end_time: time_range.end

  stopped_today = stopped_date == rules.current_date

  if stopped_today && started.nil?
    rules.label = 'Completed but not started'
    rules.color = '#66FF66'
    rules.group_priority = -1
  elsif stopped_today
    rules.label = 'Completed'
    rules.color = '#009900'
    rules.group_priority = -2
  elsif started.nil?
    rules.label = 'Start date unknown'
    rules.color = 'white'
    rules.group_priority = 4
  elsif change&.blocked?
    rules.label = 'Blocked'
    rules.color = 'red'
    rules.group_priority = 1
    rules.issue_hint = "(#{change.reasons})"
  elsif change&.stalled?
    rules.label = 'Stalled'
    rules.color = 'orange'
    rules.group_priority = 2
    rules.issue_hint = "(#{change.reasons})"
  else
    rules.label = 'Active'
    rules.color = 'lightgray'
    rules.group_priority = 3
  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

#key_blocked_stalled_change(issue:, date:, end_time:) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/jirametrics/daily_wip_by_blocked_stalled_chart.rb', line 27

def key_blocked_stalled_change issue:, date:, end_time:
  stalled_change = nil
  blocked_change = nil

  issue.blocked_stalled_changes_on_date(date: date, end_time: end_time) do |change|
    blocked_change = change if change.blocked?
    stalled_change = change if change.stalled?
  end

  return blocked_change if blocked_change
  return stalled_change if stalled_change

  nil
end