jirametrics 2.20.1 → 2.20.2pre2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cbe1101b082615d38939850c0adc688aedefe02a74537503bcd390cdf11d0d4e
4
- data.tar.gz: eeffbda7c7ba8280273e0d749ede1ed3c1caa33d06a1f50a2c47b2331035d5af
3
+ metadata.gz: 0e1e9930ee11379d275d25166f2ad60ffa8247602188bfa2916cca37ea777327
4
+ data.tar.gz: 1e3d05854f0b9082cc97fed0c3f6d9e9bd657773e001f1812bbd2235414f1492
5
5
  SHA512:
6
- metadata.gz: b73533c90e457c2c5f7a7f2d1759ccd44d218ebe984052fcb581d8ab88225abf43b5612923217b4fa7467ed11e82ba5b4fe2cc656a324f269b71c2497bf67659
7
- data.tar.gz: 57cbc54fe6c739d0c85f68cc0efcfbc6005975af0b40174ed9ee35790a83dac9b5e524601b770dffc6a3fefbd10f0d577d19b840560b3acfb63b0b542728d5fc
6
+ metadata.gz: a39fb8b65de720da19b99ca2c995bb350223a6effd2589de45fe43b348d2d2b718de1ed2f5dc0efb6038b6e85a8f926cc730080b9528937eab739a57e5c17303
7
+ data.tar.gz: d963e21a251f01eb494d5c79ab6441132efbea7cca04aad7487d7062b97f811aa8c7080464d83e7c60665cf2b50b765d5be5968c6a25285788c789a82c8cbad0
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ChangeItem
4
- attr_reader :field, :value_id, :old_value_id, :raw, :author_raw
4
+ attr_reader :field, :value_id, :old_value_id, :raw, :author_raw, :field_id
5
5
  attr_accessor :value, :old_value, :time
6
6
 
7
7
  def initialize raw:, author_raw:, time:, artificial: false
@@ -13,9 +13,15 @@ class ChangeItem
13
13
 
14
14
  @field = @raw['field']
15
15
  @value = @raw['toString']
16
- @value_id = @raw['to'].to_i
17
16
  @old_value = @raw['fromString']
18
- @old_value_id = @raw['from']&.to_i
17
+ if sprint?
18
+ @value_id = @raw['to'].split(', ').collect(&:to_i)
19
+ @old_value_id = (@raw['from'] || '').split(', ').collect(&:to_i)
20
+ else
21
+ @value_id = @raw['to'].to_i
22
+ @old_value_id = @raw['from']&.to_i
23
+ end
24
+ @field_id = @raw['fieldId']
19
25
  @artificial = artificial
20
26
  end
21
27
 
@@ -266,6 +266,8 @@ class DataQualityReport < ChartBase
266
266
 
267
267
  def scan_for_items_blocked_on_closed_tickets entry:
268
268
  entry.issue.issue_links.each do |link|
269
+ next unless settings['blocked_link_text'].include?(link.label)
270
+
269
271
  this_active = !entry.stopped
270
272
  other_active = !link.other_issue.board.cycletime.started_stopped_times(link.other_issue).last
271
273
  next unless this_active && !other_active
@@ -11,11 +11,24 @@ class FixVersion
11
11
  @raw['name']
12
12
  end
13
13
 
14
+ def description
15
+ @raw['description']
16
+ end
17
+
14
18
  def id
15
19
  @raw['id'].to_i
16
20
  end
17
21
 
22
+ def release_date
23
+ text = @raw['releaseDate']
24
+ text.nil? ? nil : Date.parse(text)
25
+ end
26
+
18
27
  def released?
19
28
  @raw['released']
20
29
  end
30
+
31
+ def archived?
32
+ @raw['archived']
33
+ end
21
34
  end
@@ -212,8 +212,56 @@ class Issue
212
212
  first_time_in_status(*board.visible_columns.collect(&:status_ids).flatten)
213
213
  end
214
214
 
215
+ # If this issue will ever be in an active sprint then return the time that it
216
+ # was first added to that sprint, whether or not the sprint was active at that
217
+ # time. Although it seems like an odd thing to calculate, it's a reasonable proxy
218
+ # for 'ready' in cases where the team doesn't have an explicit 'ready' status.
219
+ # You'd be better off with an explicit 'ready' but sometimes that's not an option.
220
+ def first_time_added_to_active_sprint
221
+ data_clazz = Struct.new(:sprint_id, :sprint_start, :sprint_stop, :change)
222
+
223
+ matching_changes = []
224
+ all_datas = []
225
+
226
+ @changes.each do |change|
227
+ next unless change.sprint?
228
+
229
+ added_sprint_ids = change.value_id - change.old_value_id
230
+ added_sprint_ids.each do |id|
231
+ data = data_clazz.new
232
+ data.sprint_id = id
233
+ data.change = change
234
+ sprint_data = raw['fields'][change.field_id].find { |sd| sd['id'].to_i == id }
235
+ data.sprint_start = parse_time(sprint_data['startDate'])
236
+ data.sprint_stop = parse_time(sprint_data['completeDate'])
237
+ all_datas << data
238
+ end
239
+
240
+ removed_sprint_ids = change.old_value_id - change.value_id
241
+ removed_sprint_ids.each do |id|
242
+ data = all_datas.find { |d| d.sprint_id == id }
243
+
244
+ all_datas.delete(data)
245
+
246
+ next if data.sprint_start.nil? || data.sprint_start >= change.time
247
+
248
+ matching_changes << data.change
249
+ end
250
+ end
251
+
252
+ # There can't be any more removes so whatever is left is a valid option
253
+ # Now all we care about is if the sprint has started.
254
+ all_datas.each do |data|
255
+ matching_changes << data.change if data.sprint_start
256
+ end
257
+
258
+ matching_changes.min(&:time)
259
+ end
260
+
215
261
  def parse_time text
216
- if text.is_a? String
262
+ if text.nil?
263
+ nil
264
+ elsif text.is_a? String
217
265
  Time.parse(text).getlocal(@timezone_offset)
218
266
  else
219
267
  Time.at(text / 1000).getlocal(@timezone_offset)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jirametrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.20.1
4
+ version: 2.20.2pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Bowler
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  - !ruby/object:Gem::Version
160
160
  version: '0'
161
161
  requirements: []
162
- rubygems_version: 3.6.9
162
+ rubygems_version: 4.0.3
163
163
  specification_version: 4
164
164
  summary: Extract Jira metrics
165
165
  test_files: []