tempest_time 0.5.5 → 0.5.6

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: c64c97500d830853e4be9c4f287a272b568ed51878f4403960b068939892fa15
4
- data.tar.gz: f4daacb9d077bf73374097d70249876c680650b6e874736870191bd46fbbdf0d
3
+ metadata.gz: 1ba7b6688e350d7f3e9408c135c4413346a9465a736115422b37e0a57a56346e
4
+ data.tar.gz: 4d0c38beeffd10ca499409cb79e9c7f49b2a599fae8d5c5a6c99a281fe894987
5
5
  SHA512:
6
- metadata.gz: cfbd5f404907aaafa4e20d74c49c9e56350b797e66f721a14daa253eea97286913edb13d81bbc02081115796ebd9e727c5dfeeceab186237dce0a210cd5f0a5e
7
- data.tar.gz: de88b4e7d39c5d77d7439930c23ac750f589ac5b50c635698d5e1d5ca25e9ee8e39d70838b83009f3b1b735014b4b5b4811d63c734f2d75df05582f6078ef538
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 ||= raw_response['results'].map do |worklog|
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
- confirm_message =
17
- "Delete #{pluralized} #{pastel.green(@worklogs.join(', '))}?"
18
- abort unless prompt.yes?(confirm_message)
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
- percentage(data.project_compliance_percentages.to_h.fetch(project, 0))
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
- (decimal * 100).to_i.to_s + '%'
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
- prompt_message = "Track #{formatted_time(time)}, "\
24
+ unless @options[:autoconfirm]
25
+ prompt_message = "Track #{formatted_time(time)}, "\
25
26
  "#{billability(@options)}, "\
26
27
  "to #{tickets.join(', ')}?"
27
- abort unless prompt.yes?(prompt_message, convert: :bool)
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))
@@ -22,7 +22,7 @@ module TempestTime
22
22
  end
23
23
 
24
24
  def compliance_percentage(time)
25
- (time.to_f / (EXPECTED_SECONDS * number_of_users)).round(2)
25
+ (time.to_f / (EXPECTED_SECONDS * number_of_users))
26
26
  end
27
27
 
28
28
  def project_compliance_percentages
@@ -1,3 +1,3 @@
1
1
  module TempestTime
2
- VERSION = '0.5.5'.freeze
2
+ VERSION = '0.5.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tempest_time
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Devan Hurst