jirametrics 2.22 → 2.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/bin/jirametrics-mcp +5 -0
  3. data/lib/jirametrics/aggregate_config.rb +10 -2
  4. data/lib/jirametrics/aging_work_bar_chart.rb +26 -10
  5. data/lib/jirametrics/aging_work_in_progress_chart.rb +43 -11
  6. data/lib/jirametrics/aging_work_table.rb +9 -7
  7. data/lib/jirametrics/anonymizer.rb +74 -1
  8. data/lib/jirametrics/atlassian_document_format.rb +93 -93
  9. data/lib/jirametrics/blocked_stalled_change.rb +5 -3
  10. data/lib/jirametrics/board.rb +28 -8
  11. data/lib/jirametrics/board_feature.rb +14 -0
  12. data/lib/jirametrics/board_movement_calculator.rb +2 -2
  13. data/lib/jirametrics/cfd_data_builder.rb +108 -0
  14. data/lib/jirametrics/change_item.rb +4 -3
  15. data/lib/jirametrics/chart_base.rb +107 -3
  16. data/lib/jirametrics/css_variable.rb +1 -1
  17. data/lib/jirametrics/cumulative_flow_diagram.rb +208 -0
  18. data/lib/jirametrics/{cycletime_config.rb → cycle_time_config.rb} +1 -2
  19. data/lib/jirametrics/cycletime_histogram.rb +15 -103
  20. data/lib/jirametrics/cycletime_scatterplot.rb +13 -98
  21. data/lib/jirametrics/daily_view.rb +38 -13
  22. data/lib/jirametrics/daily_wip_by_age_chart.rb +1 -1
  23. data/lib/jirametrics/daily_wip_by_blocked_stalled_chart.rb +1 -1
  24. data/lib/jirametrics/daily_wip_by_parent_chart.rb +4 -2
  25. data/lib/jirametrics/daily_wip_chart.rb +29 -7
  26. data/lib/jirametrics/data_quality_report.rb +38 -12
  27. data/lib/jirametrics/dependency_chart.rb +2 -2
  28. data/lib/jirametrics/download_config.rb +15 -0
  29. data/lib/jirametrics/downloader.rb +87 -5
  30. data/lib/jirametrics/downloader_for_cloud.rb +107 -22
  31. data/lib/jirametrics/downloader_for_data_center.rb +3 -2
  32. data/lib/jirametrics/estimate_accuracy_chart.rb +42 -4
  33. data/lib/jirametrics/examples/aggregated_project.rb +2 -2
  34. data/lib/jirametrics/examples/standard_project.rb +32 -19
  35. data/lib/jirametrics/expedited_chart.rb +3 -1
  36. data/lib/jirametrics/exporter.rb +15 -2
  37. data/lib/jirametrics/file_config.rb +9 -11
  38. data/lib/jirametrics/file_system.rb +35 -2
  39. data/lib/jirametrics/flow_efficiency_scatterplot.rb +5 -1
  40. data/lib/jirametrics/github_gateway.rb +115 -0
  41. data/lib/jirametrics/groupable_issue_chart.rb +4 -0
  42. data/lib/jirametrics/grouping_rules.rb +26 -4
  43. data/lib/jirametrics/html/aging_work_bar_chart.erb +3 -4
  44. data/lib/jirametrics/html/aging_work_table.erb +3 -0
  45. data/lib/jirametrics/html/cumulative_flow_diagram.erb +503 -0
  46. data/lib/jirametrics/html/daily_wip_chart.erb +38 -5
  47. data/lib/jirametrics/html/estimate_accuracy_chart.erb +2 -12
  48. data/lib/jirametrics/html/expedited_chart.erb +3 -13
  49. data/lib/jirametrics/html/flow_efficiency_scatterplot.erb +2 -8
  50. data/lib/jirametrics/html/index.css +228 -60
  51. data/lib/jirametrics/html/index.erb +6 -0
  52. data/lib/jirametrics/html/index.js +53 -3
  53. data/lib/jirametrics/html/legacy_colors.css +174 -0
  54. data/lib/jirametrics/html/sprint_burndown.erb +7 -13
  55. data/lib/jirametrics/html/throughput_chart.erb +40 -9
  56. data/lib/jirametrics/html/{cycletime_histogram.erb → time_based_histogram.erb} +59 -59
  57. data/lib/jirametrics/html/{cycletime_scatterplot.erb → time_based_scatterplot.erb} +11 -7
  58. data/lib/jirametrics/html/wip_by_column_chart.erb +250 -0
  59. data/lib/jirametrics/html_generator.rb +2 -1
  60. data/lib/jirametrics/html_report_config.rb +45 -33
  61. data/lib/jirametrics/issue.rb +197 -99
  62. data/lib/jirametrics/issue_printer.rb +97 -0
  63. data/lib/jirametrics/jira_gateway.rb +32 -10
  64. data/lib/jirametrics/mcp_server.rb +531 -0
  65. data/lib/jirametrics/project_config.rb +87 -8
  66. data/lib/jirametrics/pull_request.rb +30 -0
  67. data/lib/jirametrics/pull_request_cycle_time_histogram.rb +77 -0
  68. data/lib/jirametrics/pull_request_cycle_time_scatterplot.rb +88 -0
  69. data/lib/jirametrics/pull_request_review.rb +13 -0
  70. data/lib/jirametrics/raw_javascript.rb +4 -0
  71. data/lib/jirametrics/settings.json +3 -1
  72. data/lib/jirametrics/sprint_burndown.rb +4 -2
  73. data/lib/jirametrics/status.rb +1 -1
  74. data/lib/jirametrics/stitcher.rb +7 -1
  75. data/lib/jirametrics/throughput_by_completed_resolution_chart.rb +22 -0
  76. data/lib/jirametrics/throughput_chart.rb +73 -23
  77. data/lib/jirametrics/time_based_histogram.rb +139 -0
  78. data/lib/jirametrics/time_based_scatterplot.rb +107 -0
  79. data/lib/jirametrics/wip_by_column_chart.rb +236 -0
  80. data/lib/jirametrics.rb +58 -0
  81. metadata +52 -5
@@ -1,17 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'jirametrics/groupable_issue_chart'
3
+ require 'jirametrics/time_based_histogram'
4
4
 
5
- class CycletimeHistogram < ChartBase
6
- include GroupableIssueChart
5
+ class CycletimeHistogram < TimeBasedHistogram
7
6
  attr_accessor :possible_statuses
8
- attr_reader :show_stats
9
7
 
10
8
  def initialize block
11
9
  super()
12
10
 
13
- percentiles [50, 85, 98]
14
- @show_stats = true
11
+ @x_axis_title = 'Cycletime in days'
12
+ @y_axis_title = 'Count'
15
13
 
16
14
  header_text 'Cycletime Histogram'
17
15
  description_text <<-HTML
@@ -30,112 +28,26 @@ class CycletimeHistogram < ChartBase
30
28
  end
31
29
  end
32
30
 
33
- def percentiles percs = nil
34
- @percentiles = percs unless percs.nil?
35
- @percentiles
36
- end
37
-
38
- def disable_stats
39
- @show_stats = false
40
- end
41
-
42
- def run
31
+ def all_items
43
32
  stopped_issues = completed_issues_in_range include_unstarted: true
44
33
 
45
34
  # For the histogram, we only want to consider items that have both a start and a stop time.
46
- histogram_issues = stopped_issues.select { |issue| issue.board.cycletime.started_stopped_times(issue).first }
47
- rules_to_issues = group_issues histogram_issues
48
-
49
- the_stats = {}
50
-
51
- overall_stats = stats_for histogram_data: histogram_data_for(issues: histogram_issues), percentiles: @percentiles
52
- the_stats[:all] = overall_stats
53
- data_sets = rules_to_issues.keys.collect do |rules|
54
- the_issue_type = rules.label
55
- the_histogram = histogram_data_for(issues: rules_to_issues[rules])
56
- the_stats[the_issue_type] = stats_for histogram_data: the_histogram, percentiles: @percentiles if @show_stats
57
-
58
- data_set_for(
59
- histogram_data: the_histogram,
60
- label: the_issue_type,
61
- color: rules.color
62
- )
63
- end
64
-
65
- if data_sets.empty?
66
- return "<h1 class='foldable'>#{@header_text}</h1><div>No data matched the selected criteria. Nothing to show.</div>"
67
- end
68
-
69
- wrap_and_render(binding, __FILE__)
35
+ stopped_issues.select { |issue| issue.started_stopped_times.first }
70
36
  end
71
37
 
72
- def histogram_data_for issues:
73
- count_hash = {}
74
- issues.each do |issue|
75
- days = issue.board.cycletime.cycletime(issue)
76
- count_hash[days] = (count_hash[days] || 0) + 1 if days.positive?
77
- end
78
- count_hash
38
+ def value_for_item issue
39
+ issue.board.cycletime.cycletime(issue)
79
40
  end
80
41
 
81
- def stats_for histogram_data:, percentiles:
82
- return {} if histogram_data.empty?
83
-
84
- total_values = histogram_data.values.sum
85
-
86
- # Calculate the average
87
- weighted_sum = histogram_data.reduce(0) { |sum, (value, frequency)| sum + (value * frequency) }
88
- average = total_values.zero? ? 0 : weighted_sum.to_f / total_values
89
-
90
- # Find the mode (or modes!) and the spread of the distribution
91
- sorted_histogram = histogram_data.sort_by { |_value, frequency| frequency }
92
- max_freq = sorted_histogram[-1][1]
93
- mode = sorted_histogram.select { |_v, f| f == max_freq }
94
-
95
- minmax = histogram_data.keys.minmax
96
-
97
- # Calculate percentiles
98
- sorted_values = histogram_data.keys.sort
99
- cumulative_counts = {}
100
- cumulative_sum = 0
101
-
102
- sorted_values.each do |value|
103
- cumulative_sum += histogram_data[value]
104
- cumulative_counts[value] = cumulative_sum
105
- end
106
-
107
- percentile_results = {}
108
- percentiles.each do |percentile|
109
- rank = (percentile / 100.0) * total_values
110
- percentile_value = sorted_values.find { |value| cumulative_counts[value] >= rank }
111
- percentile_results[percentile] = percentile_value
112
- end
113
-
114
- {
115
- average: average,
116
- mode: mode.collect(&:first).sort,
117
- min: minmax[0],
118
- max: minmax[1],
119
- percentiles: percentile_results
120
- }
42
+ def title_for_item count:, value:
43
+ "#{count} items completed in #{label_days value}"
121
44
  end
122
45
 
123
- def data_set_for histogram_data:, label:, color:
124
- keys = histogram_data.keys.sort
125
- {
126
- type: 'bar',
127
- label: label,
128
- data: keys.sort.filter_map do |key|
129
- next if histogram_data[key].zero?
46
+ def sort_items items
47
+ items.sort_by(&:key_as_i)
48
+ end
130
49
 
131
- {
132
- x: key,
133
- y: histogram_data[key],
134
- title: "#{histogram_data[key]} items completed in #{label_days key}"
135
- }
136
- end,
137
- backgroundColor: color,
138
- borderRadius: 0
139
- }
50
+ def label_for_item issue, hint:
51
+ "#{issue.key} : #{issue.summary}#{" #{hint}" if hint}"
140
52
  end
141
53
  end
@@ -1,10 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'jirametrics/groupable_issue_chart'
4
-
5
- class CycletimeScatterplot < ChartBase
6
- include GroupableIssueChart
3
+ require 'jirametrics/time_based_scatterplot'
7
4
 
5
+ class CycletimeScatterplot < TimeBasedScatterplot
8
6
  attr_accessor :possible_statuses
9
7
 
10
8
  def initialize block
@@ -26,6 +24,8 @@ class CycletimeScatterplot < ChartBase
26
24
  </div>
27
25
  #{describe_non_working_days}
28
26
  HTML
27
+ @x_axis_title = 'Date completed'
28
+ @y_axis_title = 'Cycletime in days'
29
29
 
30
30
  init_configuration_block block do
31
31
  grouping_rules do |issue, rule|
@@ -33,9 +33,10 @@ class CycletimeScatterplot < ChartBase
33
33
  rule.color = color_for type: issue.type
34
34
  end
35
35
  end
36
+ end
36
37
 
37
- @percentage_lines = []
38
- @highest_y_value = 0
38
+ def minimum_y_value
39
+ 1 # Values under 1 day are data quality problems; they're flagged in the quality report instead
39
40
  end
40
41
 
41
42
  def all_items
@@ -43,104 +44,18 @@ class CycletimeScatterplot < ChartBase
43
44
  end
44
45
 
45
46
  def x_value item
46
- item.board.cycletime.started_stopped_times(item).last
47
+ item.started_stopped_times.last
47
48
  end
48
49
 
49
50
  def y_value item
50
51
  item.board.cycletime.cycletime(item)
51
52
  end
52
53
 
53
- def title_value item
54
- "#{item.key} : #{item.summary} (#{label_days(y_value(item))})"
55
- end
56
-
57
- def y_axis_heading
58
- 'Cycle time in days'
59
- end
60
-
61
- def run
62
- items = all_items
63
- data_sets = create_datasets items
64
- overall_percent_line = calculate_percent_line(items)
65
- @percentage_lines << [overall_percent_line, CssVariable['--cycletime-scatterplot-overall-trendline-color']]
66
-
67
- return "<h1>#{@header_text}</h1>No data matched the selected criteria. Nothing to show." if data_sets.empty?
68
-
69
- wrap_and_render(binding, __FILE__)
70
- end
71
-
72
- def create_datasets items
73
- data_sets = []
74
-
75
- group_issues(items).each do |rules, completed_items_by_type|
76
- label = rules.label
77
- color = rules.color
78
- percent_line = calculate_percent_line completed_items_by_type
79
- data = completed_items_by_type.filter_map { |issue| data_for_issue(issue) }
80
- data_sets << {
81
- label: "#{label} (85% at #{label_days(percent_line)})",
82
- data: data,
83
- fill: false,
84
- showLine: false,
85
- backgroundColor: color
86
- }
87
-
88
- data_sets << trend_line_data_set(label: label, data: data, color: color)
89
-
90
- @percentage_lines << [percent_line, color]
91
- end
92
- data_sets
54
+ def title_value item, rules: nil
55
+ hint = @issue_hints&.fetch(item, nil)
56
+ "#{item.key} : #{item.summary} (#{label_days(y_value(item))})#{" #{hint}" if hint}"
93
57
  end
94
58
 
95
- def show_trend_lines
96
- @show_trend_lines = true
97
- end
98
-
99
- def trend_line_data_set label:, data:, color:
100
- points = data.collect do |hash|
101
- [Time.parse(hash[:x]).to_i, hash[:y]]
102
- end
103
-
104
- # The trend calculation works with numbers only so convert Time to an int and back
105
- calculator = TrendLineCalculator.new(points)
106
- data_points = calculator.chart_datapoints(
107
- range: time_range.begin.to_i..time_range.end.to_i,
108
- max_y: @highest_y_value
109
- )
110
- data_points.each do |point_hash|
111
- point_hash[:x] = chart_format Time.at(point_hash[:x])
112
- end
113
-
114
- {
115
- type: 'line',
116
- label: "#{label} Trendline",
117
- data: data_points,
118
- fill: false,
119
- borderWidth: 1,
120
- markerType: 'none',
121
- borderColor: color,
122
- borderDash: [6, 3],
123
- pointStyle: 'dash',
124
- hidden: !@show_trend_lines
125
- }
126
- end
127
-
128
- def data_for_issue item
129
- cycle_time = y_value(item)
130
- return nil if cycle_time < 1 # These will get called out on the quality report
131
-
132
- @highest_y_value = cycle_time if @highest_y_value < cycle_time
133
-
134
- {
135
- y: cycle_time,
136
- x: chart_format(x_value(item)),
137
- title: [title_value(item)]
138
- }
139
- end
140
-
141
- def calculate_percent_line items
142
- times = items.collect { |item| y_value(item) }
143
- index = times.size * 85 / 100
144
- times.sort[index]
145
- end
59
+ # Kept for backwards compatibility with existing callers and specs
60
+ alias data_for_issue data_for_item
146
61
  end
@@ -9,7 +9,8 @@ class DailyView < ChartBase
9
9
  header_text 'Daily View'
10
10
  description_text <<-HTML
11
11
  <div class="p">
12
- This view shows all the items you'll want to discuss during your daily coordination meeting
12
+ This view shows all the items (<%= aging_issues.count %>) you'll want to discuss during your daily
13
+ coordination meeting
13
14
  (aka daily scrum, standup), in the order that you should be discussing them. The most important
14
15
  items are at the top, and the least at the bottom.
15
16
  </div>
@@ -23,7 +24,7 @@ class DailyView < ChartBase
23
24
  def run
24
25
  aging_issues = select_aging_issues
25
26
 
26
- return "<h1 class='foldable'>#{@header_text}</h1>There are no items currently in progress" if aging_issues.empty?
27
+ return "<h1 class='foldable'>#{@header_text}</h1><div>There are no items currently in progress</div>" if aging_issues.empty?
27
28
 
28
29
  result = +''
29
30
  result << render_top_text(binding)
@@ -35,7 +36,7 @@ class DailyView < ChartBase
35
36
 
36
37
  def select_aging_issues
37
38
  aging_issues = issues.select do |issue|
38
- started_at, stopped_at = issue.board.cycletime.started_stopped_times(issue)
39
+ started_at, stopped_at = issue.started_stopped_times
39
40
  started_at && !stopped_at
40
41
  end
41
42
 
@@ -72,7 +73,7 @@ class DailyView < ChartBase
72
73
 
73
74
  def make_blocked_stalled_lines issue
74
75
  today = date_range.end
75
- started_date = issue.board.cycletime.started_stopped_times(issue).first&.to_date
76
+ started_date = issue.started_stopped_times.first&.to_date
76
77
  return [] unless started_date
77
78
 
78
79
  blocked_stalled = issue.blocked_stalled_by_date(
@@ -86,9 +87,15 @@ class DailyView < ChartBase
86
87
  lines << ["#{marker} Blocked by flag"] if blocked_stalled.flag
87
88
  lines << ["#{marker} Blocked by status: #{blocked_stalled.status}"] if blocked_stalled.blocked_by_status?
88
89
  blocked_stalled.blocking_issue_keys&.each do |key|
89
- lines << ["#{marker} Blocked by issue: #{key}"]
90
- blocking_issue = issues.find { |i| i.key == key }
91
- lines << blocking_issue if blocking_issue
90
+ blocking_issue = issues.find_by_key key: key, include_hidden: true
91
+ if blocking_issue
92
+ lines << "<section><div class=\"foldable startFolded\">#{marker} Blocked by issue: " \
93
+ "#{make_issue_label issue: blocking_issue, done: blocking_issue.done?}</div>"
94
+ lines << blocking_issue
95
+ lines << '</section>'
96
+ else
97
+ lines << ["#{marker} Blocked by issue: #{key} (no description found)"]
98
+ end
92
99
  end
93
100
  elsif blocked_stalled.stalled_by_status?
94
101
  lines << ["#{color_block '--stalled-color'} Stalled by status: #{blocked_stalled.status}"]
@@ -146,7 +153,18 @@ class DailyView < ChartBase
146
153
  line << "Assignee: <img src='#{issue.assigned_to_icon_url}' class='icon' /> <b>#{issue.assigned_to}</b>"
147
154
  end
148
155
 
149
- line << "Due: <b>#{issue.due_date}</b>" if issue.due_date
156
+ if issue.due_date
157
+ today = date_range.end
158
+ days = (issue.due_date - today).to_i
159
+ relative =
160
+ if days.zero? then 'today'
161
+ elsif days.positive? then "in #{label_days days}"
162
+ else "#{label_days(-days)} ago"
163
+ end
164
+ content = "#{issue.due_date} (#{relative})"
165
+ content = "<span style='background: var(--warning-banner)'>#{content}</span>" if days.negative?
166
+ line << "Due: <b>#{content}</b>"
167
+ end
150
168
 
151
169
  block = lambda do |collection, label|
152
170
  unless collection.empty?
@@ -166,7 +184,7 @@ class DailyView < ChartBase
166
184
 
167
185
  return lines if subtasks.empty?
168
186
 
169
- lines << '<section><div class="foldable">Child issues</div>'
187
+ lines << "<section><div class=\"foldable startFolded\">Child issues (#{subtasks.count})</div>"
170
188
  lines += subtasks
171
189
  lines << '</section>'
172
190
 
@@ -237,9 +255,11 @@ class DailyView < ChartBase
237
255
 
238
256
  def make_description_lines issue
239
257
  description = issue.raw['fields']['description']
240
- result = []
241
- result << [atlassian_document_format.to_html(description)] if description
242
- result
258
+ return [] unless description
259
+
260
+ text = "<div class='foldable startFolded'>Description</div>" \
261
+ "<div>#{atlassian_document_format.to_html(description)}</div>"
262
+ [[text]]
243
263
  end
244
264
 
245
265
  def assemble_issue_lines issue, child:
@@ -247,6 +267,7 @@ class DailyView < ChartBase
247
267
 
248
268
  lines = []
249
269
  lines << [make_title_line(issue: issue, done: done)]
270
+ lines << make_not_visible_line(issue)
250
271
  lines += make_parent_lines(issue) unless child
251
272
  lines += make_stats_lines(issue: issue, done: done)
252
273
  unless done
@@ -256,7 +277,7 @@ class DailyView < ChartBase
256
277
  lines += make_child_lines(issue)
257
278
  lines += make_history_lines(issue)
258
279
  end
259
- lines
280
+ lines.compact
260
281
  end
261
282
 
262
283
  def render_issue issue, child:
@@ -278,4 +299,8 @@ class DailyView < ChartBase
278
299
  end
279
300
  result << '</div>'
280
301
  end
302
+
303
+ def make_not_visible_line issue
304
+ not_visible_text issue
305
+ end
281
306
  end
@@ -49,7 +49,7 @@ class DailyWipByAgeChart < DailyWipChart
49
49
  end
50
50
 
51
51
  def default_grouping_rules issue:, rules:
52
- started, stopped = issue.board.cycletime.started_stopped_dates(issue)
52
+ started, stopped = issue.started_stopped_dates
53
53
 
54
54
  if stopped && started.nil? # We can't tell when it started
55
55
  @has_completed_but_not_started = true
@@ -39,7 +39,7 @@ class DailyWipByBlockedStalledChart < DailyWipChart
39
39
  end
40
40
 
41
41
  def default_grouping_rules issue:, rules:
42
- started, stopped = issue.board.cycletime.started_stopped_times(issue)
42
+ started, stopped = issue.started_stopped_times
43
43
  stopped_date = stopped&.to_date
44
44
  started_date = started&.to_date
45
45
 
@@ -26,11 +26,13 @@ class DailyWipByParentChart < DailyWipChart
26
26
  end
27
27
 
28
28
  def default_grouping_rules issue:, rules:
29
- parent = issue.parent&.key
29
+ parent = issue.parent
30
30
  if parent
31
- rules.label = parent
31
+ rules.label = parent.key
32
+ rules.label_hint = "#{parent.key} : #{parent.summary}"
32
33
  else
33
34
  rules.label = 'No parent'
35
+ rules.label_hint = 'No parent'
34
36
  rules.group_priority = 1000
35
37
  rules.color = '--body-background'
36
38
  end
@@ -3,12 +3,16 @@
3
3
  require 'jirametrics/chart_base'
4
4
 
5
5
  class DailyGroupingRules < GroupingRules
6
- attr_accessor :current_date, :group_priority, :issue_hint
6
+ attr_accessor :current_date, :group_priority, :issue_hint, :highlight
7
7
 
8
8
  def initialize
9
9
  super
10
10
  @group_priority = 0
11
11
  end
12
+
13
+ def group
14
+ [@label, @color, @highlight ? true : false]
15
+ end
12
16
  end
13
17
 
14
18
  class DailyWipChart < ChartBase
@@ -19,6 +23,8 @@ class DailyWipChart < ChartBase
19
23
 
20
24
  header_text default_header_text
21
25
  description_text default_description_text
26
+ @x_axis_title = nil
27
+ @y_axis_title = 'Count of items'
22
28
 
23
29
  instance_eval(&block) if block
24
30
 
@@ -33,8 +39,15 @@ class DailyWipChart < ChartBase
33
39
  issue_rules_by_active_date = group_issues_by_active_dates
34
40
  possible_rules = select_possible_rules issue_rules_by_active_date
35
41
 
42
+ conflicting_labels = possible_rules
43
+ .group_by(&:label)
44
+ .select { |_label, rules| rules.any?(&:highlight) && rules.any? { |r| !r.highlight } }
45
+ .keys
46
+
36
47
  data_sets = possible_rules.collect do |grouping_rule|
37
- make_data_set grouping_rule: grouping_rule, issue_rules_by_active_date: issue_rules_by_active_date
48
+ suffix = conflicting_labels.include?(grouping_rule.label) && grouping_rule.highlight ? '*' : ''
49
+ make_data_set grouping_rule: grouping_rule, issue_rules_by_active_date: issue_rules_by_active_date,
50
+ label_suffix: suffix
38
51
  end
39
52
  if @trend_lines
40
53
  data_sets = @trend_lines.filter_map do |group_labels, line_color|
@@ -82,16 +95,17 @@ class DailyWipChart < ChartBase
82
95
  hash
83
96
  end
84
97
 
85
- def make_data_set grouping_rule:, issue_rules_by_active_date:
98
+ def make_data_set grouping_rule:, issue_rules_by_active_date:, label_suffix: ''
86
99
  positive = grouping_rule.group_priority >= 0
100
+ display_label = "#{grouping_rule.label}#{label_suffix}"
87
101
 
88
102
  data = issue_rules_by_active_date.collect do |date, issue_rules|
89
- # issues = []
90
103
  issue_strings = issue_rules
91
104
  .select { |_issue, rules| rules.group == grouping_rule.group }
92
105
  .sort_by { |issue, _rules| issue.key_as_i }
93
106
  .collect { |issue, rules| "#{issue.key} : #{issue.summary.strip} #{rules.issue_hint}" }
94
- title = ["#{grouping_rule.label} (#{label_issues issue_strings.size})"] + issue_strings
107
+ title_label = grouping_rule.label_hint || display_label
108
+ title = ["#{title_label} (#{label_issues issue_strings.size})"] + issue_strings
95
109
 
96
110
  {
97
111
  x: date,
@@ -100,11 +114,19 @@ class DailyWipChart < ChartBase
100
114
  }
101
115
  end
102
116
 
117
+ color = grouping_rule.color || random_color
118
+ background_color = if grouping_rule.highlight
119
+ RawJavascript.new("createDiagonalPattern(#{color.to_json})")
120
+ else
121
+ color
122
+ end
123
+
103
124
  {
104
125
  type: 'bar',
105
- label: grouping_rule.label,
126
+ label: display_label,
127
+ label_hint: grouping_rule.label_hint,
106
128
  data: data,
107
- backgroundColor: grouping_rule.color || random_color,
129
+ backgroundColor: background_color,
108
130
  borderColor: CssVariable['--wip-chart-border-color'],
109
131
  borderWidth: grouping_rule.color.to_s == 'var(--body-background)' ? 1 : 0,
110
132
  borderRadius: positive ? 0 : 5
@@ -45,6 +45,7 @@ class DataQualityReport < ChartBase
45
45
  scan_for_completed_issues_without_a_start_time entry: entry
46
46
  scan_for_status_change_after_done entry: entry
47
47
  scan_for_backwards_movement entry: entry, backlog_statuses: backlog_statuses
48
+ scan_for_issue_not_in_active_sprint entry: entry
48
49
  scan_for_issues_not_created_in_a_backlog_status entry: entry, backlog_statuses: backlog_statuses
49
50
  scan_for_stopped_before_started entry: entry
50
51
  scan_for_issues_not_started_with_subtasks_that_have entry: entry
@@ -68,7 +69,7 @@ class DataQualityReport < ChartBase
68
69
  result << render_problem_type(:status_changes_after_done)
69
70
  result << render_problem_type(:backwards_through_status_categories)
70
71
  result << render_problem_type(:backwords_through_statuses)
71
- result << render_problem_type(:status_not_on_board)
72
+ result << render_problem_type(:issue_not_visible_on_board)
72
73
  result << render_problem_type(:created_in_wrong_status)
73
74
  result << render_problem_type(:stopped_before_started)
74
75
  result << render_problem_type(:issue_not_started_but_subtasks_have)
@@ -120,7 +121,7 @@ class DataQualityReport < ChartBase
120
121
 
121
122
  def initialize_entries
122
123
  @entries = @issues.filter_map do |issue|
123
- started, stopped = issue.board.cycletime.started_stopped_times(issue)
124
+ started, stopped = issue.started_stopped_times
124
125
  next if stopped && stopped < time_range.begin
125
126
  next if started && started > time_range.end
126
127
 
@@ -194,7 +195,7 @@ class DataQualityReport < ChartBase
194
195
  # If it's been moved back to backlog then it's on a different report. Ignore it here.
195
196
  detail = nil if backlog_statuses.any? { |s| s.name == change.value }
196
197
 
197
- entry.report(problem_key: :status_not_on_board, detail: detail) unless detail.nil?
198
+ entry.report(problem_key: :issue_not_visible_on_board, detail: detail) unless detail.nil?
198
199
  elsif change.old_value.nil?
199
200
  # Do nothing
200
201
  elsif index < last_index
@@ -223,6 +224,29 @@ class DataQualityReport < ChartBase
223
224
  end
224
225
  end
225
226
 
227
+ def scan_for_issue_not_in_active_sprint entry:
228
+ issue = entry.issue
229
+ return unless issue.board.scrum?
230
+ return if issue.sprints.any?(&:active?)
231
+
232
+ entry.report(problem_key: :issue_not_visible_on_board, detail: 'Issue is not in an active sprint')
233
+ end
234
+
235
+ def scan_for_issue_never_visible_on_board entry:
236
+ issue = entry.issue
237
+ ever_visible = issue.changes.any? do |change|
238
+ next unless change.status?
239
+
240
+ issue.board.visible_columns.any? { |col| col.status_ids.include?(change.value_id) }
241
+ end
242
+ return if ever_visible
243
+
244
+ entry.report(
245
+ problem_key: :issue_not_visible_on_board,
246
+ detail: 'Issue has never been in a status mapped to a visible column on the board'
247
+ )
248
+ end
249
+
226
250
  def scan_for_issues_not_created_in_a_backlog_status entry:, backlog_statuses:
227
251
  creation_change = entry.issue.changes.find { |issue| issue.status? }
228
252
 
@@ -250,7 +274,7 @@ class DataQualityReport < ChartBase
250
274
 
251
275
  started_subtasks = []
252
276
  entry.issue.subtasks.each do |subtask|
253
- started_subtasks << subtask if subtask.board.cycletime.started_stopped_times(subtask).first
277
+ started_subtasks << subtask if subtask.started_stopped_times.first
254
278
  end
255
279
 
256
280
  return if started_subtasks.empty?
@@ -269,7 +293,7 @@ class DataQualityReport < ChartBase
269
293
  next unless settings['blocked_link_text'].include?(link.label)
270
294
 
271
295
  this_active = !entry.stopped
272
- other_active = !link.other_issue.board.cycletime.started_stopped_times(link.other_issue).last
296
+ other_active = !link.other_issue.started_stopped_times.last
273
297
  next unless this_active && !other_active
274
298
 
275
299
  entry.report(
@@ -295,14 +319,14 @@ class DataQualityReport < ChartBase
295
319
  return "#{delta} hours" if delta < 24
296
320
 
297
321
  delta /= 24
298
- "#{delta} days"
322
+ label_days delta
299
323
  end
300
324
 
301
325
  def scan_for_incomplete_subtasks_when_issue_done entry:
302
326
  return unless entry.stopped
303
327
 
304
328
  subtask_labels = entry.issue.subtasks.filter_map do |subtask|
305
- subtask_started, subtask_stopped = subtask.board.cycletime.started_stopped_times(subtask)
329
+ subtask_started, subtask_stopped = subtask.started_stopped_times
306
330
 
307
331
  if !subtask_started && !subtask_stopped
308
332
  "#{subtask_label subtask} (Not even started)"
@@ -409,12 +433,14 @@ class DataQualityReport < ChartBase
409
433
  HTML
410
434
  end
411
435
 
412
- def render_status_not_on_board problems
436
+ def render_issue_not_visible_on_board problems
437
+ unique_issue_count = problems.map(&:first).uniq.size
413
438
  <<-HTML
414
- #{label_issues problems.size} were not visible on the board for some period of time. This may impact
415
- timings as the work was likely to have been forgotten if it wasn't visible. What does "not visible"
416
- mean in this context? The issue was in a status that is not mapped to any visible column on the board.
417
- Look in "unmapped statuses" on your board.
439
+ #{problems.size} #{'time'.then { |w| problems.size == 1 ? w : "#{w}s" }} across #{label_issues unique_issue_count},
440
+ an item was not visible on the board. This may impact
441
+ timings as the work was likely to have been forgotten if it wasn't visible. An issue can be not visible
442
+ for two reasons: the issue was in a status that is not mapped to any visible column on the board
443
+ (look in "unmapped statuses" on your board), or for scrum boards, the issue was not in an active sprint.
418
444
  HTML
419
445
  end
420
446
 
@@ -57,7 +57,7 @@ class DependencyChart < ChartBase
57
57
  end
58
58
 
59
59
  svg = execute_graphviz(dot_graph.join("\n"))
60
- "<h1>#{@header_text}</h1><div>#{@description_text}</div>#{shrink_svg svg}"
60
+ "<h1 class='foldable'>#{@header_text}</h1><div>#{@description_text}#{shrink_svg svg}</div>"
61
61
  end
62
62
 
63
63
  def link_rules &block
@@ -231,7 +231,7 @@ class DependencyChart < ChartBase
231
231
  elsif is_done
232
232
  line2 << 'Done'
233
233
  else
234
- started_at = issue.board.cycletime.started_stopped_times(issue).first
234
+ started_at = issue.started_stopped_times.first
235
235
  if started_at.nil?
236
236
  line2 << 'Not started'
237
237
  else