gpuzzletime 0.2.1 → 0.3.0

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: 25d45d4c0242828b4e577bc2273a0c7a5813d33a65ab8760f0c08795d51340ff
4
- data.tar.gz: fdcea7b3498c360fc80f91da9f6bbb39ec45d365f01c72c2f40e86bfae251e34
3
+ metadata.gz: 770445fa339c64739dcfbff341b410757cf80b54c1340688f21bedf04ebf6ba3
4
+ data.tar.gz: d527556a32fd3e722caeaed3001b254d08cc2e77df05f9f91968efa5cd23d919
5
5
  SHA512:
6
- metadata.gz: c32b7c7b65f50769a852e728f3bcc15f5cf585ac530b5ba8c8436787510f31349b22302d644405ee505a90f4b8969c21727f4e5829ea113d9bd0b74da05991f1
7
- data.tar.gz: cb3cf7c061d46a3a9b60a7aab3df4a7859d31f7ab36994749593e1a430d94ba15abf780de0ceac051b1fee792c3e96c20c1316919367b2090df1919d9c488940
6
+ metadata.gz: 2114fb4d188c30c11cbb260e6e64c501ba43352a5b26ca52248a76aa4e806eff62a53f34c7070860a2af1baa130569e6bbce9196204145a46b3eb1f33937e6fe
7
+ data.tar.gz: 22eabdb94e69f3813f6f43987beec3500ab1370ae36bb72048121b24acd0b7ea49a34fe88d380bf624d13f862c1b84c34f15e16a03be971f361518a7b5da1c43
data/README.md CHANGED
@@ -32,7 +32,7 @@ small tooling to transfer timelog-entries from gtimelog's timelog.txt to the Puz
32
32
  - [ ] with a dedicated cli?
33
33
  - [ ] from a REST-Endpoint of PTime?
34
34
  - [ ] automatically prefill billable
35
- - [ ] from time-accounts
35
+ - [x] from time-accounts
36
36
  - [ ] from *-notation
37
37
  - [ ] allow to have a list of "favourite" time-accounts
38
38
  - [ ] select best-matching time-account according to tags, possibly limited to the favourites
@@ -116,13 +116,15 @@ module Gpuzzletime
116
116
  end
117
117
 
118
118
  def url_options(start, entry)
119
+ account = infer_account(entry)
119
120
  {
120
121
  work_date: entry[:date],
121
122
  'ordertime[ticket]': entry[:ticket],
122
123
  'ordertime[description]': entry[:description],
123
124
  'ordertime[from_start_time]': start,
124
125
  'ordertime[to_end_time]': entry[:time],
125
- 'ordertime[account_id]': infer_account(entry),
126
+ 'ordertime[account_id]': account,
127
+ 'ordertime[billable]': infer_billable(account),
126
128
  }
127
129
  .map { |key, value| [key, ERB::Util.url_encode(value)].join('=') }
128
130
  .join('&')
@@ -181,5 +183,13 @@ module Gpuzzletime
181
183
  cmd = %(#{parser} "#{entry[:ticket]}" "#{entry[:description]}" #{tags.map(&:inspect).join(' ')})
182
184
  `#{cmd}`.chomp # maybe only execute if parser is in correct dir?
183
185
  end
186
+
187
+ def infer_billable(account)
188
+ script = Pathname.new('~/.config/gpuzzletime/billable').expand_path
189
+
190
+ return 1 unless script.exist?
191
+
192
+ `#{script} #{account}`.chomp == 'true' ? 1 : 0
193
+ end
184
194
  end
185
195
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Version
4
4
  module Gpuzzletime
5
- VERSION = '0.2.1'
5
+ VERSION = '0.3.0'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gpuzzletime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.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: 2018-09-12 00:00:00.000000000 Z
11
+ date: 2018-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler