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 +4 -4
- data/lib/time_sheet/time/cmd.rb +30 -3
- data/lib/time_sheet/time/entry.rb +6 -1
- data/lib/time_sheet/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3eafc5b6d18708b232660dc63e6b27c965c43013c569da732780e72638543644
|
4
|
+
data.tar.gz: 0e11e2d36a118c0db1b5d3f7ff0e5c59fbe8e94df4910e75fd5d2598b84ed326
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bafb5ce2ad3372ced67f0f1b498ad0f4966772c93cae6a455e20ca445c077f95295f254e3dddc41a58d11fe34271610c1557faddd6da4fe9c85167a5a704a3ef
|
7
|
+
data.tar.gz: ad6ccabcfb8a866676cfa9e5cc3659d7dd7ab62913ef63689e5cd4101ccdfdadc5b1390633e9c8c7005c2515b1d6e01a8adba8082e68d976064077dc7652b67f
|
data/lib/time_sheet/time/cmd.rb
CHANGED
@@ -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', '
|
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
|
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
|
-
|
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
|
|
data/lib/time_sheet/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2021-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spreadsheet
|