jirametrics 2.7.1 → 2.8

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.
@@ -13,7 +13,7 @@ class StatusCollection
13
13
  excluding = expand_statuses excluding
14
14
 
15
15
  @list.filter_map do |status|
16
- keep = status.category_name == category_name ||
16
+ keep = status.category.name == category_name ||
17
17
  including.any? { |s| s.name == status.name }
18
18
  keep = false if excluding.any? { |s| s.name == status.name }
19
19
 
@@ -56,12 +56,45 @@ class StatusCollection
56
56
  filter_status_names category_name: 'Done', including: including, excluding: excluding
57
57
  end
58
58
 
59
- def find_by_name name
60
- find { |status| status.name == name }
59
+ # Return the status matching this id or nil if it can't be found.
60
+ def find_by_id id
61
+ @list.find { |status| status.id == id }
62
+ end
63
+
64
+ def find_all_by_name name
65
+ @list.select { |status| status.name == name }
66
+ end
67
+
68
+ def find_category_by_name name
69
+ category = @list.find { |status| status.category.name == name }&.category
70
+ unless category
71
+ set = Set.new
72
+ @list.each do |status|
73
+ set << status.category.to_s
74
+ end
75
+ raise "Unable to find status category #{name.inspect} in [#{set.to_a.sort.join(', ')}]"
76
+ end
77
+ category
78
+ end
79
+
80
+ # This is used to create a status that was found in the history but has since been deleted.
81
+ def fabricate_status_for id:, name:
82
+ first_in_progress_status = @list.find { |s| s.category.indeterminate? }
83
+ raise "Can't find even one in-progress status in [#{set.to_a.sort.join(', ')}]" unless first_in_progress_status
84
+
85
+ status = Status.new(
86
+ name: name,
87
+ id: id,
88
+ category_name: first_in_progress_status.category.name,
89
+ category_id: first_in_progress_status.category.id,
90
+ category_key: first_in_progress_status.category.key
91
+ )
92
+ self << status
93
+ status
61
94
  end
62
95
 
63
- def find(&block)= @list.find(&block)
64
96
  def collect(&block) = @list.collect(&block)
97
+ def find(&block) = @list.find(&block)
65
98
  def each(&block) = @list.each(&block)
66
99
  def select(&block) = @list.select(&block)
67
100
  def <<(arg) = @list << arg
@@ -70,6 +103,6 @@ class StatusCollection
70
103
  def delete(object) = @list.delete(object)
71
104
 
72
105
  def inspect
73
- "StatusCollection(#{@list.collect(&:inspect).join(', ')})"
106
+ "StatusCollection(#{@list.join(', ')})"
74
107
  end
75
108
  end
@@ -82,7 +82,7 @@ class ThroughputChart < ChartBase
82
82
  def throughput_dataset periods:, completed_issues:
83
83
  periods.collect do |period|
84
84
  closed_issues = completed_issues.filter_map do |issue|
85
- stop_date = issue.board.cycletime.started_stopped_times(issue).last&.to_date
85
+ stop_date = issue.board.cycletime.started_stopped_dates(issue).last
86
86
  [stop_date, issue] if stop_date && period.include?(stop_date)
87
87
  end
88
88
 
data/lib/jirametrics.rb CHANGED
@@ -7,6 +7,13 @@ class JiraMetrics < Thor
7
7
  true
8
8
  end
9
9
 
10
+ map %w[--version -v] => :__print_version
11
+
12
+ desc '--version, -v', 'print the version'
13
+ def __print_version
14
+ puts Gem.loaded_specs['jirametrics'].version
15
+ end
16
+
10
17
  option :config
11
18
  option :name
12
19
  desc 'export', "Export data into either reports or CSV's as per the configuration"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jirametrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.1
4
+ version: '2.8'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Bowler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-06 00:00:00.000000000 Z
11
+ date: 2024-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: random-word