ptimelog 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/ptimelog.rb +1 -0
- data/lib/ptimelog/command/version.rb +16 -0
- data/lib/ptimelog/day.rb +46 -12
- data/lib/ptimelog/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efde9baef775527079705c4a87dfa656a8df4f186381a88c6ebd51e0cfdfd4c8
|
4
|
+
data.tar.gz: d68a4f17937165e47fe381dedade07ab625ae98c426a30c6cf09d806a2b77466
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 439357c8e138db02f373cdefedbcd3abd79e16aa5997a8140449327352e0efbdb436b293989b0a19086fcbe41a07c09e7743a3e68b9945cd885080e31b06f056
|
7
|
+
data.tar.gz: 2ca4a1333cd8f21fc07deb995f2ab31b62ada7a8b95286f050bb3f481adbddf85471df28be2c80b5a838c0a91d0e770dbf144830f1349298157161284d545a6f
|
data/README.md
CHANGED
@@ -17,10 +17,10 @@ small tooling to transfer timelog-entries from gtimelog's timelog.txt to the Puz
|
|
17
17
|
- [x] infer time-account from ticket-format
|
18
18
|
- [x] support user-supplied ticket-parsers
|
19
19
|
- [x] get ticket-parser from tags
|
20
|
-
- [
|
20
|
+
- [x] merge equal adjacent entries into one
|
21
21
|
- [ ] complete login/entry automation
|
22
22
|
- [ ] handle authentication
|
23
|
-
- [ ] login and store cookie
|
23
|
+
- [ ] login and store cookie (https://stackoverflow.com/questions/12399087/curl-to-access-a-page-that-requires-a-login-from-a-different-page#12399176)
|
24
24
|
- [ ] send user and pwd with every request
|
25
25
|
- [ ] make entries
|
26
26
|
- [ ] open day in browser for review
|
data/lib/ptimelog.rb
CHANGED
data/lib/ptimelog/day.rb
CHANGED
@@ -12,26 +12,60 @@ module Ptimelog
|
|
12
12
|
next unless date # guard against the machine
|
13
13
|
next unless @date == :all || @date == date # limit to one day if passed
|
14
14
|
|
15
|
-
entries[date] =
|
16
|
-
|
15
|
+
entries[date] = join_similar(entries_of_day(lines)) # lines |> entries_of_day |> join_similar"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def timelog
|
22
|
+
Timelog.load
|
23
|
+
end
|
17
24
|
|
18
|
-
|
19
|
-
|
20
|
-
|
25
|
+
def entries_of_day(lines)
|
26
|
+
entries = []
|
27
|
+
start = nil # at the start of the day, we have no previous end
|
21
28
|
|
22
|
-
|
29
|
+
lines.each do |line|
|
30
|
+
entry = Entry.from_timelog(line)
|
31
|
+
entry.start_time = start
|
23
32
|
|
24
|
-
|
25
|
-
end
|
33
|
+
entries << entry if entry.valid?
|
26
34
|
|
27
|
-
|
35
|
+
start = entry.finish_time # store previous ending for nice display of next entry
|
28
36
|
end
|
37
|
+
|
38
|
+
entries
|
29
39
|
end
|
30
40
|
|
31
|
-
|
41
|
+
def join_similar(list)
|
42
|
+
return [] if list.empty?
|
43
|
+
return list if list.one?
|
32
44
|
|
33
|
-
|
34
|
-
|
45
|
+
one, *tail = list
|
46
|
+
two, *rest = tail
|
47
|
+
|
48
|
+
joined = maybe_join(one, two)
|
49
|
+
|
50
|
+
if joined.one?
|
51
|
+
join_similar(joined + rest)
|
52
|
+
else
|
53
|
+
[one] + join_similar(tail)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def maybe_join(one, two)
|
58
|
+
if one.ticket == two.ticket &&
|
59
|
+
one.description == two.description &&
|
60
|
+
one.finish_time == two.start_time
|
61
|
+
|
62
|
+
joined = one.dup
|
63
|
+
joined.finish_time = two.finish_time
|
64
|
+
|
65
|
+
[joined]
|
66
|
+
else
|
67
|
+
[one, two]
|
68
|
+
end
|
35
69
|
end
|
36
70
|
end
|
37
71
|
end
|
data/lib/ptimelog/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ptimelog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthias Viehweger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: naught
|
@@ -153,6 +153,7 @@ files:
|
|
153
153
|
- lib/ptimelog/command/edit.rb
|
154
154
|
- lib/ptimelog/command/show.rb
|
155
155
|
- lib/ptimelog/command/upload.rb
|
156
|
+
- lib/ptimelog/command/version.rb
|
156
157
|
- lib/ptimelog/configuration.rb
|
157
158
|
- lib/ptimelog/day.rb
|
158
159
|
- lib/ptimelog/deprecation_warning.rb
|