time_cop 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/time_cop/accountability.rb +24 -13
- data/lib/time_cop/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 556970075820cedaa47a84fb0e5b5e75b3dc1512
|
4
|
+
data.tar.gz: 85b78ef60edc687c8743ce77e68f835567227321
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c86d629a0d66e25e4aaefc9de16a1fd4d34cf84f97560f3a7fa5f992f02cff41f4ee125d45756f6d7d4af8dc67627d074e663931660d7a5cc902bf0eecd7e681
|
7
|
+
data.tar.gz: a41f5b231bebeec3bf0f9842e989f5915dc082b4080ea454a81a2a2b92ce5f7f5048f2876260a0ceab30ff6f4807cd7b8c082f595ab8fe4705db93e6803276a7
|
@@ -15,7 +15,7 @@ module TimeCop
|
|
15
15
|
q4: [{month: 10, day: 1}, {month: 12, day: 31}]
|
16
16
|
}
|
17
17
|
|
18
|
-
def initialize(harvest_client:, date: Date.today, today: Date.today, report_builder: nil, email: nil, hours_per_week:
|
18
|
+
def initialize(harvest_client:, date: Date.today, today: Date.today, report_builder: nil, email: nil, hours_per_week: 34)
|
19
19
|
@client = harvest_client
|
20
20
|
@date = date
|
21
21
|
@today = today
|
@@ -46,7 +46,7 @@ module TimeCop
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def date_from_period(period)
|
49
|
-
|
49
|
+
Date.new(date.year, period[:month], period[:day])
|
50
50
|
end
|
51
51
|
|
52
52
|
def select_quarter
|
@@ -82,8 +82,10 @@ module TimeCop
|
|
82
82
|
@quarterly_tracked_time_by_user ||= report_builder.generate
|
83
83
|
end
|
84
84
|
|
85
|
-
def total_quarter_time_tracked
|
86
|
-
quarterly_tracked_time_by_user.
|
85
|
+
def total_quarter_time_tracked(include_future = true)
|
86
|
+
quarterly_tracked_time_by_user.select do |t|
|
87
|
+
include_future || t.spent_at <= Date.today
|
88
|
+
end.map(&:hours).reduce(0, :+)
|
87
89
|
end
|
88
90
|
|
89
91
|
def total_quarter_days
|
@@ -124,18 +126,26 @@ module TimeCop
|
|
124
126
|
|
125
127
|
def average_quarter_hours_per_day
|
126
128
|
if weekdays_so_far(false) > 0
|
127
|
-
total_quarter_time_tracked / weekdays_so_far(false)
|
129
|
+
total_quarter_time_tracked(false) / weekdays_so_far(false)
|
128
130
|
else
|
129
131
|
0
|
130
132
|
end
|
131
133
|
end
|
132
134
|
|
133
135
|
def projected_quarter_hours
|
134
|
-
(
|
136
|
+
(total_quarter_time_tracked + projected_future_hours) - expected_quarter_hours
|
135
137
|
end
|
136
138
|
|
137
|
-
def
|
138
|
-
|
139
|
+
def projected_future_hours
|
140
|
+
(weekdays_left(false) - future_days_with_work)* average_quarter_hours_per_day
|
141
|
+
end
|
142
|
+
|
143
|
+
def future_days_with_work
|
144
|
+
quarterly_tracked_time_by_user.select{ |t| t.spent_at > Date.today}.map(&:spent_at).uniq.length
|
145
|
+
end
|
146
|
+
|
147
|
+
def current_hours_delta(include_future = true)
|
148
|
+
total_quarter_time_tracked(include_future) - expected_quarter_hours_to_today
|
139
149
|
end
|
140
150
|
|
141
151
|
def quarterly_hours_delta
|
@@ -146,7 +156,7 @@ module TimeCop
|
|
146
156
|
if weekdays_between(today, end_of_quarter_date) == 0
|
147
157
|
quarterly_hours_delta
|
148
158
|
else
|
149
|
-
quarterly_hours_delta /
|
159
|
+
quarterly_hours_delta / weekdays_left(false).to_f
|
150
160
|
end
|
151
161
|
end
|
152
162
|
|
@@ -179,20 +189,21 @@ module TimeCop
|
|
179
189
|
def print_report
|
180
190
|
puts "Quarter Period: #{start_of_quarter_date} - #{end_of_quarter_date}"
|
181
191
|
puts "Hours Per Week: #{@hours_per_week}"
|
192
|
+
puts "Weekdays So Far: #{weekdays_so_far(false)}"
|
182
193
|
puts ""
|
183
194
|
puts "Quarterly Hour Target: #{expected_quarter_hours.round(2)}"
|
184
195
|
puts "Quarterly Hours Charged: #{total_quarter_time_tracked.round(2)}"
|
185
196
|
if active_quarter?
|
186
197
|
puts ""
|
198
|
+
puts "Additional Hours Needed By End Of Quarter: #{quarterly_hours_delta.round(2)}"
|
187
199
|
puts "Business Days Left In The Quarter (Excluding Today): #{weekdays_left(false)}"
|
188
200
|
puts ""
|
189
|
-
puts "Additional Hours Needed By End Of Quarter: #{quarterly_hours_delta.round(2)}"
|
190
201
|
puts "Average Hours Per Business Day Worked: #{average_quarter_hours_per_day.round(2)}"
|
191
202
|
puts "Hours Per Business Day Average Needed: #{quarterly_hours_per_business_day_needed.round(2)}"
|
192
203
|
end
|
193
|
-
puts""
|
194
|
-
puts "
|
195
|
-
puts "Projected Surplus(+)/Deficit(-): #{Accountability.paint_number(projected_quarter_hours.round(2))}" if active_quarter?
|
204
|
+
puts ""
|
205
|
+
puts "Current Surplus(+)/Deficit(-): #{Accountability.paint_number(current_hours_delta(false).round(2))}"
|
206
|
+
puts "Projected Quarter Surplus(+)/Deficit(-): #{Accountability.paint_number(projected_quarter_hours.round(2))}" if active_quarter?
|
196
207
|
end
|
197
208
|
end
|
198
209
|
end
|
data/lib/time_cop/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: time_cop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Clopton
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: harvested
|