jirametrics 2.5 → 2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jirametrics/downloader.rb +2 -10
- data/lib/jirametrics/file_system.rb +2 -1
- data/lib/jirametrics/issue.rb +51 -2
- data/lib/jirametrics/settings.json +1 -0
- data/lib/jirametrics/status.rb +12 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 749f92d4329a18999bf8954aee5b41955047ef263d7a37fe766b2233d697a8c9
|
4
|
+
data.tar.gz: f174b2241d23a3d7a9ff34b20093ff0716406197563df4b7f4f6447773fc7a51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f89eb6c1a9655163d91b19d9f5b92f79a7d714e6b45fe53e972248f20c5d788a356e6d5be0cbfe24a70665381bf0a7a28ce898b0e31cef9c4c3349d8ce335558
|
7
|
+
data.tar.gz: b95ee06e9b3ef78aba0635aa634fa56082da2aa8bfa759f7e38be2eb2b6889a04a23e99dc8aa9a021391d8db4fe797247fb2b9379c5801fc2c5ec7a3bc3ff103
|
@@ -6,7 +6,7 @@ require 'json'
|
|
6
6
|
class Downloader
|
7
7
|
CURRENT_METADATA_VERSION = 4
|
8
8
|
|
9
|
-
attr_accessor :metadata
|
9
|
+
attr_accessor :metadata
|
10
10
|
attr_reader :file_system
|
11
11
|
|
12
12
|
# For testing only
|
@@ -54,8 +54,7 @@ class Downloader
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def log text, both: false
|
57
|
-
@file_system.log text
|
58
|
-
puts text if both && !@quiet_mode
|
57
|
+
@file_system.log text, also_write_to_stderr: both
|
59
58
|
end
|
60
59
|
|
61
60
|
def find_board_ids
|
@@ -137,13 +136,6 @@ class Downloader
|
|
137
136
|
issue.raw['fields']['subtasks']&.each do |raw_subtask|
|
138
137
|
@issue_keys_pending_download << raw_subtask['key']
|
139
138
|
end
|
140
|
-
|
141
|
-
# Links
|
142
|
-
# We shouldn't blindly follow links as some, like cloners, aren't valuable and are just wasting time/effort
|
143
|
-
# to download
|
144
|
-
# issue.raw['fields']['issuelinks'].each do |raw_link|
|
145
|
-
# @issue_keys_pending_download << IssueLink(raw: raw_link).other_issue.key
|
146
|
-
# end
|
147
139
|
end
|
148
140
|
|
149
141
|
def exit_if_call_failed json
|
@@ -27,8 +27,9 @@ class FileSystem
|
|
27
27
|
File.write(filename, content)
|
28
28
|
end
|
29
29
|
|
30
|
-
def log message
|
30
|
+
def log message, also_write_to_stderr: false
|
31
31
|
logfile.puts message
|
32
|
+
$stderr.puts message if also_write_to_stderr
|
32
33
|
end
|
33
34
|
|
34
35
|
# In some Jira instances, a sizeable portion of the JSON is made up of empty fields. I've seen
|
data/lib/jirametrics/issue.rb
CHANGED
@@ -137,7 +137,15 @@ class Issue
|
|
137
137
|
status = board.possible_statuses.find_by_name(name)
|
138
138
|
return status if status
|
139
139
|
|
140
|
-
|
140
|
+
@board.project_config.file_system.log(
|
141
|
+
"Warning: Status name #{name.inspect} for issue #{key} not found in" \
|
142
|
+
" #{board.possible_statuses.collect(&:name).inspect}" \
|
143
|
+
"\n See Q1 in the FAQ for more details: https://github.com/mikebowler/jirametrics/wiki/FAQ\n",
|
144
|
+
also_write_to_stderr: true
|
145
|
+
)
|
146
|
+
status = Status.new(name: name, category_name: 'In Progress')
|
147
|
+
board.possible_statuses << status
|
148
|
+
status
|
141
149
|
end
|
142
150
|
|
143
151
|
def first_status_change_after_created
|
@@ -251,6 +259,7 @@ class Issue
|
|
251
259
|
|
252
260
|
blocked_link_texts = settings['blocked_link_text']
|
253
261
|
stalled_threshold = settings['stalled_threshold_days']
|
262
|
+
flagged_means_blocked = !!settings['flagged_means_blocked']
|
254
263
|
|
255
264
|
blocking_issue_keys = []
|
256
265
|
|
@@ -273,7 +282,7 @@ class Issue
|
|
273
282
|
blocking_stalled_changes: result
|
274
283
|
)
|
275
284
|
|
276
|
-
if change.flagged?
|
285
|
+
if change.flagged? && flagged_means_blocked
|
277
286
|
flag = change.value
|
278
287
|
flag = nil if change.value == ''
|
279
288
|
elsif change.status?
|
@@ -362,6 +371,46 @@ class Issue
|
|
362
371
|
inserted_stalled
|
363
372
|
end
|
364
373
|
|
374
|
+
# return [number of active seconds, total seconds] that this issue had up to the end_time.
|
375
|
+
# It does not include data before issue start or after issue end
|
376
|
+
def flow_efficiency_numbers end_time:, settings: {}
|
377
|
+
issue_start = @board.cycletime.started_time(self)
|
378
|
+
return [0.0, 0.0] if !issue_start || issue_start > end_time
|
379
|
+
|
380
|
+
value_add_time = 0.0
|
381
|
+
issue_stop = @board.cycletime.stopped_time(self)
|
382
|
+
end_time = issue_stop if issue_stop && issue_stop < end_time
|
383
|
+
|
384
|
+
active_start = nil
|
385
|
+
blocked_stalled_changes(end_time: end_time, settings: settings).each_with_index do |change, index|
|
386
|
+
break if change.time > end_time
|
387
|
+
|
388
|
+
if index.zero?
|
389
|
+
active_start = change.time if change.active?
|
390
|
+
next
|
391
|
+
end
|
392
|
+
|
393
|
+
# Already active and we just got another active.
|
394
|
+
next if active_start && change.active?
|
395
|
+
|
396
|
+
if change.active?
|
397
|
+
active_start = change.time
|
398
|
+
elsif active_start && change.time >= issue_start
|
399
|
+
# Not active now but we have been. Record the active time.
|
400
|
+
change_delta = change.time - [issue_start, active_start].max
|
401
|
+
value_add_time += change_delta
|
402
|
+
active_start = nil
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
406
|
+
if active_start
|
407
|
+
change_delta = end_time - [issue_start, active_start].max
|
408
|
+
value_add_time += change_delta if change_delta.positive?
|
409
|
+
end
|
410
|
+
|
411
|
+
[value_add_time, end_time - issue_start]
|
412
|
+
end
|
413
|
+
|
365
414
|
def all_subtask_activity_times
|
366
415
|
subtask_activity_times = []
|
367
416
|
@subtasks.each do |subtask|
|
data/lib/jirametrics/status.rb
CHANGED
@@ -38,8 +38,18 @@ class Status
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def to_s
|
41
|
-
"Status(name=#{@name.inspect},
|
42
|
-
"
|
41
|
+
result = +"Status(name=#{@name.inspect}," \
|
42
|
+
" id=#{@id.inspect}," \
|
43
|
+
" category_name=#{@category_name.inspect}," \
|
44
|
+
" category_id=#{@category_id.inspect}," \
|
45
|
+
" project_id=#{@project_id}"
|
46
|
+
result << ' artificial' if artificial?
|
47
|
+
result << ')'
|
48
|
+
result
|
49
|
+
end
|
50
|
+
|
51
|
+
def artificial?
|
52
|
+
@raw.nil?
|
43
53
|
end
|
44
54
|
|
45
55
|
def value_equality_ignored_variables
|
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.
|
4
|
+
version: '2.6'
|
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
|
+
date: 2024-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: random-word
|