time-sheet 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 +8 -0
- data/lib/time_sheet/time.rb +1 -1
- data/lib/time_sheet/time/cmd.rb +1 -0
- data/lib/time_sheet/time/entry.rb +15 -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: 0bacee0db8abe56f89e78df5cfef966da22efcc24e5fff2db291714727815cd4
|
4
|
+
data.tar.gz: 91e6034615db1c7d56ff9e91ba47200c41ac83338ae8049c22c6bf4ea93f67e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3aff4885cc228ce208263dd4f3f2a9c93465b2e819d863595222060ae5c1902ee35c40a93b631bcc9ea6ca38192b8c5e5214712cbb7592145880d3ff33080db
|
7
|
+
data.tar.gz: f01226ee033c0f451d367ad2616601294d3a6a6e2db414a5f3d728cd7f2fa3805bfde8ebc4241fdf2dc1bf8fdde80c15dc9ceee1614708c87bf559cf6fb14628
|
data/README.md
CHANGED
@@ -3,6 +3,14 @@
|
|
3
3
|
This gem allows you to parse a spreadsheet with time tracking information to
|
4
4
|
generate various statistics suitable for invoices and project effort estimates.
|
5
5
|
|
6
|
+
## Changelog
|
7
|
+
|
8
|
+
v0.9.0
|
9
|
+
|
10
|
+
* introduced employee data column: To use it, add a column "employee" to the
|
11
|
+
spreadsheets and use flag `-e` to filter by it. If employee is not set, it
|
12
|
+
falls back to "Me".
|
13
|
+
|
6
14
|
## Installation
|
7
15
|
|
8
16
|
```bash
|
data/lib/time_sheet/time.rb
CHANGED
@@ -41,7 +41,7 @@ module TimeSheet::Time
|
|
41
41
|
unless results['entries'].empty?
|
42
42
|
time = (
|
43
43
|
(options[:to] || Util.day_end) -
|
44
|
-
(options[:from] || results['entries'].first[
|
44
|
+
(options[:from] || results['entries'].first[1].to_time)
|
45
45
|
).to_i
|
46
46
|
days = (time.to_f / 60 / 60 / 24).round
|
47
47
|
end
|
data/lib/time_sheet/time/cmd.rb
CHANGED
@@ -112,6 +112,7 @@ class TimeSheet::Time::Cmd
|
|
112
112
|
o.string '-p', '--project', 'take only entries of this project into account'
|
113
113
|
o.string '-a', '--activity', 'take only entries of this activity into account'
|
114
114
|
o.string '-d', '--description', 'consider only entries matching this description'
|
115
|
+
o.string '-e', '--employee', 'consider only entries for this employee'
|
115
116
|
o.float '-r', '--rate', 'use an alternative hourly rate (default: 80.0)', default: 80.00
|
116
117
|
o.boolean '-s', '--summary', 'when reporting, add summary section'
|
117
118
|
o.boolean '--trim', 'compact the output for processing as CSV', default: false
|
@@ -41,6 +41,10 @@ class TimeSheet::Time::Entry
|
|
41
41
|
)
|
42
42
|
end
|
43
43
|
|
44
|
+
def employee
|
45
|
+
@employee ||= @data['employee'] || (self.prev ? self.prev.employee : 'Me')
|
46
|
+
end
|
47
|
+
|
44
48
|
# Experiment to add timezone support. However, this would complicate every day
|
45
49
|
# handing because of daylight saving time changes.
|
46
50
|
# def start_zone
|
@@ -87,6 +91,7 @@ class TimeSheet::Time::Entry
|
|
87
91
|
to = (filters[:to] ? filters[:to] : nil)
|
88
92
|
to = (to + 1).to_time if to.is_a?(Date)
|
89
93
|
|
94
|
+
self.class.attrib_matches_any?(employee, filters[:employee]) &&
|
90
95
|
self.class.attrib_matches_any?(description, filters[:description]) &&
|
91
96
|
self.class.attrib_matches_any?(project, filters[:project]) &&
|
92
97
|
self.class.attrib_matches_any?(activity, filters[:activity]) &&
|
@@ -114,14 +119,22 @@ class TimeSheet::Time::Entry
|
|
114
119
|
if (self.start >= self.end) && self.next
|
115
120
|
raise TimeSheet::Time::Exception.new('time entry has no end')
|
116
121
|
end
|
122
|
+
|
123
|
+
if !employee
|
124
|
+
raise TimeSheet::Time::Exception.new('no employee set')
|
125
|
+
end
|
117
126
|
end
|
118
127
|
|
119
128
|
def to_row
|
120
|
-
[
|
129
|
+
[
|
130
|
+
employee, date, start, self.end, duration.to_i, project, activity,
|
131
|
+
description
|
132
|
+
]
|
121
133
|
end
|
122
134
|
|
123
135
|
def to_s
|
124
136
|
values = [
|
137
|
+
employee,
|
125
138
|
date.strftime('%Y-%m-%d'),
|
126
139
|
start.strftime('%H:%M'),
|
127
140
|
self.end.strftime('%H:%M'),
|
@@ -134,6 +147,7 @@ class TimeSheet::Time::Entry
|
|
134
147
|
|
135
148
|
def to_hash
|
136
149
|
return {
|
150
|
+
'employee' => employee,
|
137
151
|
'date' => date,
|
138
152
|
'start' => start,
|
139
153
|
'end' => self.end,
|
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.9.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:
|
11
|
+
date: 2020-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spreadsheet
|