time-sheet 0.11.1 → 0.14.0

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: f5e2d47f0a17abcab7e6b134fd87b176dd753a5dc8022a66d59dcd8b16b3393b
4
- data.tar.gz: 3335117c3db218920b623aa6759d231f77867b41db80a4bf532a2ba65d334451
3
+ metadata.gz: 3eafc5b6d18708b232660dc63e6b27c965c43013c569da732780e72638543644
4
+ data.tar.gz: 0e11e2d36a118c0db1b5d3f7ff0e5c59fbe8e94df4910e75fd5d2598b84ed326
5
5
  SHA512:
6
- metadata.gz: 449c5648f9734732fe4f7c89bdfbcba97b847c213460ac66ecaf69601fd90524ba451cc2abed6b3cb87c1ef1a519218843046b63783e01496e4662f80cb9bb42
7
- data.tar.gz: cc06940f56f3c29aa6f1dadde4f3c171f9589ffb28abcd3ca1adebfacb5df3b88477d9527b49e5ea7dc44b73a149330489ef84dcf570570e1d6a965ae881543f
6
+ metadata.gz: bafb5ce2ad3372ced67f0f1b498ad0f4966772c93cae6a455e20ca445c077f95295f254e3dddc41a58d11fe34271610c1557faddd6da4fe9c85167a5a704a3ef
7
+ data.tar.gz: ad6ccabcfb8a866676cfa9e5cc3659d7dd7ab62913ef63689e5cd4101ccdfdadc5b1390633e9c8c7005c2515b1d6e01a8adba8082e68d976064077dc7652b67f
@@ -39,6 +39,8 @@ class TimeSheet::Time::Cmd
39
39
  invoice
40
40
  when 'report', 'default'
41
41
  report
42
+ when 'verify'
43
+ verify
42
44
  when 'today', 't'
43
45
  options[:from] = TimeSheet::Time::Util.today
44
46
  options[:summary] = true
@@ -105,6 +107,7 @@ class TimeSheet::Time::Cmd
105
107
  'available commands:',
106
108
  " report (default): list entries conforming to given criteria",
107
109
  " invoice: compress similar entries and filter petty ones. Optionally package for e.g. monthly invoicing",
110
+ " verify: check syntax and semantics in your input spreadsheets",
108
111
  "\n general options:"
109
112
  ].join("\n")
110
113
 
@@ -117,7 +120,7 @@ class TimeSheet::Time::Cmd
117
120
  o.string '-t', '--to', 'ignore entries more recent than the date given'
118
121
  o.string '-p', '--project', 'take only entries of this project into account'
119
122
  o.string '-a', '--activity', 'take only entries of this activity into account'
120
- o.string '--tags', 'take only entries with these tags into account (comma separated, not case sensitive)'
123
+ o.string '--tags', 'filter by tag (comma separated, not case sensitive, prefix tag with ! to exclude)'
121
124
  o.string '-d', '--description', 'consider only entries matching this description'
122
125
  o.string '-e', '--employee', 'consider only entries for this employee'
123
126
  o.float '-r', '--rate', 'use an alternative hourly rate (default: 80.0)', default: 80.00
@@ -144,6 +147,26 @@ class TimeSheet::Time::Cmd
144
147
  end
145
148
  end
146
149
 
150
+ def verify
151
+ convert_to_time
152
+
153
+ entries = TimeSheet::Time::Parser.new(options[:location]).entries
154
+
155
+ puts 'checking for changes in project with carried-over description ...'
156
+ entries.each do |entry|
157
+ next unless entry.matches?(options)
158
+
159
+ if entry.prev && entry.prev.project != entry.project
160
+ # we check for the same object because that means that the value has
161
+ # been carried over from the previous entry and that likely represents
162
+ # an oversight in these circumstances
163
+ if entry.prev.description.equal?(entry.description)
164
+ puts "-> | #{entry}"
165
+ end
166
+ end
167
+ end
168
+ end
169
+
147
170
  def invoice
148
171
  convert_to_time
149
172
 
@@ -156,11 +179,15 @@ class TimeSheet::Time::Cmd
156
179
  end
157
180
 
158
181
  if options[:package]
159
- package = data.last.map{|entry| entry[1]}.sum
182
+ package = (data.last.nil? ? 0 : data.last.map{|entry| entry[1]}.sum)
160
183
  total = options[:package] * 60
161
184
  percent = (package / total.to_f * 100)
162
185
 
163
- puts "last package duration: #{package}/#{total} (#{percent.round 2}%)"
186
+ puts [
187
+ "current package: #{package}/#{total}",
188
+ "(#{(package / 60.0).round(2)}/#{(total / 60.0).round(2)} hours,",
189
+ "#{percent.round 2}%)"
190
+ ].join(' ')
164
191
  end
165
192
  end
166
193
 
@@ -105,7 +105,12 @@ class TimeSheet::Time::Entry
105
105
  return true if tags.empty?
106
106
 
107
107
  tags.all? do |tag|
108
- self.tags.include?(tag)
108
+ if tag.match?(/^\!/)
109
+ t = tag.gsub(/\!/, '')
110
+ !self.tags.include?(t)
111
+ else
112
+ self.tags.include?(tag)
113
+ end
109
114
  end
110
115
  end
111
116
 
@@ -1,3 +1,3 @@
1
1
  module TimeSheet
2
- VERSION = "0.11.1"
2
+ VERSION = "0.14.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time-sheet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moritz Schepp
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-25 00:00:00.000000000 Z
11
+ date: 2021-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spreadsheet