Class: DailyWipByAgeChart

Inherits:
DailyWipChart show all
Defined in:
lib/jirametrics/daily_wip_by_age_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
# File 'lib/jirametrics/daily_wip_by_age_chart.rb', line 10

def default_description_text
  <<-HTML
    <p>
      This chart shows the highest WIP on each given day. The WIP is color coded so you can see
      how old it is and hovering over the bar will show you exactly which work items it relates
      to. The green bar underneath, shows how many items completed on that day.
    </p>
    <p>
      "Completed without being started" reflects the fact that while we know that it completed
      that day, we were unable to determine when it had started. These items will show up in
      white at the top. Note that the white is approximate because we don't know exactly when
      it started so we're guessing.
    </p>
  HTML
end

#default_grouping_rules(issue:, rules:) ⇒ Object



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

def default_grouping_rules issue:, rules:
  cycletime = issue.board.cycletime
  started = cycletime.started_time(issue)&.to_date
  stopped = cycletime.stopped_time(issue)&.to_date

  rules.issue_hint = "(age: #{label_days (rules.current_date - started + 1).to_i})" if started

  if stopped && started.nil? # We can't tell when it started
    not_started stopped: stopped, rules: rules, created: issue.created.to_date
  elsif stopped == rules.current_date
    stopped_today rules: rules
  else
    group_by_age started: started, rules: rules
  end
end

#default_header_textObject



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

def default_header_text
  'Daily WIP grouped by Age'
end

#group_by_age(started:, rules:) ⇒ Object



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

def group_by_age started:, rules:
  age = rules.current_date - started + 1

  case age
  when 1
    rules.label = 'Less than a day'
    rules.color = '#aaaaaa'
    rules.group_priority = 10 # Highest is top
  when 2..7
    rules.label = 'A week or less'
    rules.color = '#80bfff'
    rules.group_priority = 9
  when 8..14
    rules.label = 'Two weeks or less'
    rules.color = '#ffd700'
    rules.group_priority = 8
  when 15..28
    rules.label = 'Four weeks or less'
    rules.color = '#ce6300'
    rules.group_priority = 7
  else
    rules.label = 'More than four weeks'
    rules.color = '#990000'
    rules.group_priority = 6
  end
end

#not_started(stopped:, rules:, created:) ⇒ Object



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

def not_started stopped:, rules:, created:
  if stopped == rules.current_date
    rules.label = 'Completed but not started'
    rules.color = '#66FF66'
    rules.group_priority = -1
  else
    rules.label = 'Start date unknown'
    rules.color = 'white'
    rules.group_priority = 11
    created_days = rules.current_date - created + 1
    rules.issue_hint = "(created: #{label_days created_days.to_i} earlier, stopped on #{stopped})"
  end
end

#stopped_today(rules:) ⇒ Object



56
57
58
59
60
# File 'lib/jirametrics/daily_wip_by_age_chart.rb', line 56

def stopped_today rules:
  rules.label = 'Completed'
  rules.color = '#009900'
  rules.group_priority = -2
end