toggl-worktime 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/toggl-worktime +2 -0
- data/lib/toggl/worktime/driver.rb +9 -0
- data/lib/toggl/worktime/merger.rb +4 -0
- data/lib/toggl/worktime/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 145ec982c592fc482e71954ae7868b0d223e0d63
|
4
|
+
data.tar.gz: c820648ad85b0ac6ee3ea967c02b746a17a0a6ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 066c63d7e8a0f5a0f382d515e9a8b8b673ed322fb9448c726ca0dcba0cbe0c74765c78fcd46199281fd604f18f9f08d41a66cc961dbc51b47bc7806c18b69f1d
|
7
|
+
data.tar.gz: 07023fa7dfd214bc3f7405751e85a4c979424f106391e6015ca9b43631a391651634a45a0ea86007b7b148802a7893076b57e861afb92dfbd7ac24fa5b325722
|
data/exe/toggl-worktime
CHANGED
@@ -41,6 +41,15 @@ module Toggl
|
|
41
41
|
def time_expr(t)
|
42
42
|
t ? t.strftime('%F %T') : 'nil'
|
43
43
|
end
|
44
|
+
|
45
|
+
def total_time
|
46
|
+
time = @merger.total_time
|
47
|
+
total_seconds = time.numerator
|
48
|
+
hours = total_seconds / (60 * 60)
|
49
|
+
minutes = (total_seconds - (hours * 60 * 60)) / 60
|
50
|
+
seconds = total_seconds % 60
|
51
|
+
format("%02d:%02d:%02d", hours, minutes, seconds)
|
52
|
+
end
|
44
53
|
end
|
45
54
|
end
|
46
55
|
end
|
@@ -4,12 +4,15 @@ module Toggl
|
|
4
4
|
module Worktime
|
5
5
|
# Time-entries merger
|
6
6
|
class Merger
|
7
|
+
attr_reader :total_time
|
8
|
+
|
7
9
|
def initialize(time_entries)
|
8
10
|
@time_entries = time_entries
|
9
11
|
@current_start = nil
|
10
12
|
@current_stop = nil
|
11
13
|
@continuing = true
|
12
14
|
@last_stop = nil
|
15
|
+
@total_time = 0
|
13
16
|
end
|
14
17
|
|
15
18
|
def merge
|
@@ -35,6 +38,7 @@ module Toggl
|
|
35
38
|
@last_stop = stop
|
36
39
|
@current_start = start if @current_start.nil?
|
37
40
|
@current_stop = stop if @current_stop.nil?
|
41
|
+
@total_time += stop - start
|
38
42
|
yield [start, stop]
|
39
43
|
end
|
40
44
|
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.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomoya KABE
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: togglv8
|