toggl-worktime 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f726845f28a920e1348ee0fd4fc2b136a6394b8f4007ea8498095b6eddc39e5a
4
- data.tar.gz: e820f632627f8b8b137008cb48b4a9678ec14682aef3256750ccb8367a4a7d65
3
+ metadata.gz: cd9c63f2884fb32f927ce384477911a5a87984cc18a6ffa7d6cec577ed5eb9b6
4
+ data.tar.gz: 2ce8946cf15a0b258d18820cc5347656cc2c7b089ae21122571b158cd32c5f2e
5
5
  SHA512:
6
- metadata.gz: 4352863b125a2315ded1ec35702f0a04976fd2a3957ad0fd16a487251a98869f653de2fa01931a81e77c8a05950fafc4e56fe2cde32745b3d673d0ae430f91ce
7
- data.tar.gz: d890b93dc1664bf686c5a36cbc271b24a5f7b95fc66b02a4a9bfa40cfb35d301e01feb89eb46e4fd8d9462d91c4daf89a904a31e3ab8343ba21b3f6a8d290f8d
6
+ metadata.gz: 1fda7e45a8e887561adc06a3e24f98f0c50a225b8188756c8cfa6576ed9bc27274505069342e077c32de17f846013728be73813f2478715e530b5d759198358f
7
+ data.tar.gz: eae7f300a27c108b2db455c6459eaa1c05319de6f2ccad040b5ec0d490fc8aece985b75e784108f341130d5ee961323a68881439a93aa9a17fac3a8231d9e3d8
data/.rubocop.yml CHANGED
@@ -8,3 +8,7 @@ Style/Documentation:
8
8
 
9
9
  Metrics/MethodLength:
10
10
  Max: 15
11
+
12
+ Metrics/BlockLength:
13
+ Exclude:
14
+ - 'spec/**/*'
@@ -8,7 +8,7 @@ module Toggl
8
8
  class Merger
9
9
  attr_reader :total_time
10
10
 
11
- ONE_DAY_MINUTES = 24 * 60
11
+ ONE_MINUTE_SECONDS = 60
12
12
 
13
13
  def initialize(time_entries, config)
14
14
  @time_entries = time_entries
@@ -28,10 +28,12 @@ module Toggl
28
28
  next
29
29
  end
30
30
  work_time << [@current_start, @current_stop]
31
+ @total_time += @current_stop - @current_start
31
32
  @current_start = start
32
33
  @current_stop = stop
33
34
  end
34
35
  work_time << [@current_start, @last_stop]
36
+ @total_time += @current_stop - @current_start
35
37
  work_time
36
38
  end
37
39
 
@@ -45,8 +47,6 @@ module Toggl
45
47
  @current_stop = stop if @current_stop.nil?
46
48
  if start.nil? || stop.nil?
47
49
  warn 'start or stop time is nil: total time may be incomplete'
48
- else
49
- @total_time += stop - start
50
50
  end
51
51
  yield [start, stop]
52
52
  end
@@ -54,12 +54,14 @@ module Toggl
54
54
 
55
55
  def parse_date(date, zone_offset)
56
56
  return nil if date.nil?
57
+
57
58
  ::Time.parse(date).getlocal(zone_offset)
58
59
  end
59
60
 
60
61
  def continuing(start)
61
62
  return true if @current_stop.nil?
62
- interval = (start - @current_stop) * ONE_DAY_MINUTES
63
+
64
+ interval = (start - @current_stop) / ONE_MINUTE_SECONDS
63
65
  @continuing = interval < @config.working_interval_min
64
66
  end
65
67
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Toggl
4
4
  module Worktime
5
- VERSION = '0.3.0'
5
+ VERSION = '0.3.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toggl-worktime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomoya KABE
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-01 00:00:00.000000000 Z
11
+ date: 2018-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print