ecm_time_tracking 0.0.5 → 0.0.6
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d245c95a5abfbfa011148b82bbe34d92711796df
|
4
|
+
data.tar.gz: 4fe00072c0fcdd672e36f9c2d42dc7195f90caa2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 431bb84a92c210ec2e8d31ab90ef0adb8732431c84cd305f778d41ba51ca26673dfde097eaa034614325d6959d97331fdd803da25e0cb82a0b00d9e8f08cb32d
|
7
|
+
data.tar.gz: 913fe50c0a79ee1f94af9683e54a1972c8fb98bcdcb6ca2382be14a062fd4187f036d2262fdf4af2758cb157a676d120ae9dbf23334efb3b74cab4896f54e677
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Ecm
|
2
|
+
module TimeTracking
|
3
|
+
class SoftwareDeveloperSumsService < SumsService
|
4
|
+
attr_accessor :gross_overtime_by_month
|
5
|
+
attr_accessor :net_overtime_by_month
|
6
|
+
|
7
|
+
def calculate_sums
|
8
|
+
self.overtime = calculate_overtime
|
9
|
+
self.count_by_entry_type = self.entries.inject(Hash.new(0)) do |memo, entry|
|
10
|
+
memo[entry.entry_type] += 1
|
11
|
+
memo
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def entries_by_month
|
16
|
+
entries.group_by { |e| e.begin_at.beginning_of_month }
|
17
|
+
end
|
18
|
+
|
19
|
+
def calculate_overtime
|
20
|
+
self.gross_overtime_by_month = self.entries_by_month.each_with_object({}) { |(month, entries), h| h[month] = entries.map(&:overtime).reduce(0, :+) }
|
21
|
+
self.net_overtime_by_month = self.gross_overtime_by_month.each_with_object({}) { |(month, gross_overtime), h| h[month] = (overtime = (gross_overtime - included_monthly_overtime)) < 0 ? 0 : overtime }
|
22
|
+
self.net_overtime_by_month.values.reduce(0, :+)
|
23
|
+
end
|
24
|
+
|
25
|
+
def included_monthly_overtime
|
26
|
+
10 * 3600
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecm_time_tracking
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Vasquez Angel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -40,6 +40,7 @@ files:
|
|
40
40
|
- app/helpers/ecm/time_tracking/application_helper.rb
|
41
41
|
- app/models/ecm/time_tracking/entry.rb
|
42
42
|
- app/models/ecm/time_tracking/entry_type.rb
|
43
|
+
- app/services/ecm/time_tracking/software_developer_sums_service.rb
|
43
44
|
- app/services/ecm/time_tracking/sums_service.rb
|
44
45
|
- app/views/layouts/ecm/time_tracking/application.html.erb
|
45
46
|
- config/locales/de.yml
|