tempest_time 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tempest_time/api/tempo_api/responses/list_worklogs.rb +9 -1
- data/lib/tempest_time/commands/delete.rb +7 -3
- data/lib/tempest_time/commands/report.rb +13 -4
- data/lib/tempest_time/commands/track.rb +4 -2
- data/lib/tempest_time/models/report.rb +1 -1
- data/lib/tempest_time/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ba7b6688e350d7f3e9408c135c4413346a9465a736115422b37e0a57a56346e
|
4
|
+
data.tar.gz: 4d0c38beeffd10ca499409cb79e9c7f49b2a599fae8d5c5a6c99a281fe894987
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c90fa07f62adb8928ff2842b5d0502a88166ced7992cded2e0c7fbb146704378f83f59d798e91503524413c0eb4d1501942b5df4fec5add33ccaabd295e719c2
|
7
|
+
data.tar.gz: f821ca56abd35b260be25d0b0fb857a087e460d55f02a4cbf19065dc37d07eef0f7dbeb932b322b486a83b0e7f86d90af17fed21defca2e533c786a4bc023f75
|
@@ -10,7 +10,7 @@ module TempoAPI
|
|
10
10
|
attr_reader :worklogs, :total_hours_spent
|
11
11
|
|
12
12
|
def worklogs
|
13
|
-
@worklogs ||=
|
13
|
+
@worklogs ||= results.map do |worklog|
|
14
14
|
TempoAPI::Models::Worklog.new(
|
15
15
|
id: worklog['tempoWorklogId'],
|
16
16
|
issue: worklog.dig('issue', 'key'),
|
@@ -23,6 +23,14 @@ module TempoAPI
|
|
23
23
|
def total_hours_spent
|
24
24
|
worklogs.map(&:hours).reduce(:+)&.round(2) || 0
|
25
25
|
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
attr_reader :results
|
30
|
+
|
31
|
+
def results
|
32
|
+
@results = raw_response['results'] || []
|
33
|
+
end
|
26
34
|
end
|
27
35
|
end
|
28
36
|
end
|
@@ -13,9 +13,13 @@ module TempestTime
|
|
13
13
|
|
14
14
|
def execute(input: $stdin, output: $stdout)
|
15
15
|
pluralized = @worklogs.length > 1 ? 'worklogs' : 'worklog'
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
|
17
|
+
unless @options[:autoconfirm]
|
18
|
+
confirm_message =
|
19
|
+
"Delete #{pluralized} #{pastel.green(@worklogs.join(', '))}?"
|
20
|
+
abort unless prompt.yes?(confirm_message)
|
21
|
+
end
|
22
|
+
|
19
23
|
@worklogs.each { |worklog| delete_worklog(worklog) }
|
20
24
|
end
|
21
25
|
|
@@ -111,19 +111,28 @@ module TempestTime
|
|
111
111
|
def row(data)
|
112
112
|
row = [
|
113
113
|
data.user,
|
114
|
-
percentage(data.total_compliance_percentage),
|
115
|
-
percentage(data.utilization_percentage)
|
114
|
+
right_align(percentage(data.total_compliance_percentage)),
|
115
|
+
right_align(percentage(data.utilization_percentage))
|
116
116
|
]
|
117
117
|
projects.each do |project|
|
118
118
|
row.push(
|
119
|
-
|
119
|
+
right_align(
|
120
|
+
percentage(
|
121
|
+
data.project_compliance_percentages.to_h.fetch(project, 0)
|
122
|
+
)
|
123
|
+
)
|
120
124
|
)
|
121
125
|
end
|
122
126
|
row
|
123
127
|
end
|
124
128
|
|
129
|
+
def right_align(value)
|
130
|
+
{ value: value, alignment: :right }
|
131
|
+
end
|
132
|
+
|
125
133
|
def percentage(decimal)
|
126
|
-
|
134
|
+
return '' unless decimal.positive?
|
135
|
+
(decimal * 100.0).round(1).to_s + '%'
|
127
136
|
end
|
128
137
|
end
|
129
138
|
end
|
@@ -21,10 +21,12 @@ module TempestTime
|
|
21
21
|
time = @options[:split] ? parsed_time(@time) / @tickets.count : parsed_time(@time)
|
22
22
|
tickets = @tickets.any? ? @tickets.map(&:upcase) : [automatic_ticket]
|
23
23
|
|
24
|
-
|
24
|
+
unless @options[:autoconfirm]
|
25
|
+
prompt_message = "Track #{formatted_time(time)}, "\
|
25
26
|
"#{billability(@options)}, "\
|
26
27
|
"to #{tickets.join(', ')}?"
|
27
|
-
|
28
|
+
abort unless prompt.yes?(prompt_message, convert: :bool)
|
29
|
+
end
|
28
30
|
|
29
31
|
tickets.each do |ticket|
|
30
32
|
track_time(time, @options.merge(ticket: ticket))
|
data/lib/tempest_time/version.rb
CHANGED