ecm_time_tracking 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/ecm/time_tracking/entry.rb +6 -5
- data/app/models/ecm/time_tracking/entry_type.rb +27 -0
- data/config/locales/de.yml +8 -1
- data/db/migrate/20160305142931_create_ecm_time_tracking_entries.rb +1 -0
- data/db/migrate/20160307185539_create_ecm_time_tracking_entry_types.rb +10 -0
- data/lib/ecm/time_tracking/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5c131b35bbb0364d26d38f996943e9be397781c
|
4
|
+
data.tar.gz: 9741719c01035c18fd114bb47ddcc0a725722f8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9eeeaabdae7262b126c5225c0c60e8b29714e369eee67b5b8284bd56086422b0389ee8b6beb1ec7af2219470858f9f2d802b3c7d2f9b6c745ea473164017008
|
7
|
+
data.tar.gz: 36de389b82d7e2c03806bb14f55833b3f10370679633563a688d1a5e5839359d891771f25d69c3f9ab695ba1b1ef80d49d865423a45c40b195f4e96f5d296a1a
|
@@ -4,6 +4,7 @@ module Ecm::TimeTracking
|
|
4
4
|
DEFAULT_BREAK_LENGTH_IN_MINUTES = 45
|
5
5
|
|
6
6
|
belongs_to :tracker, class_name: Configuration.tracker_class_name, foreign_key: 'tracker_id'
|
7
|
+
belongs_to :entry_type
|
7
8
|
|
8
9
|
validates :tracker, :begin_at, :end_at, presence: true
|
9
10
|
|
@@ -22,7 +23,11 @@ module Ecm::TimeTracking
|
|
22
23
|
end
|
23
24
|
|
24
25
|
def overtime
|
25
|
-
length -
|
26
|
+
length - due_in_seconds - (break_length_in_seconds || 0)
|
27
|
+
end
|
28
|
+
|
29
|
+
def due_in_seconds
|
30
|
+
entry_type.try(:due_in_seconds) || 0
|
26
31
|
end
|
27
32
|
|
28
33
|
private
|
@@ -32,9 +37,5 @@ module Ecm::TimeTracking
|
|
32
37
|
self.begin_at = self.end_at - DEFAULT_DUE_HOURS_PER_DAY.hours - DEFAULT_BREAK_LENGTH_IN_MINUTES.minutes
|
33
38
|
self.break_length_in_minutes = DEFAULT_BREAK_LENGTH_IN_MINUTES
|
34
39
|
end
|
35
|
-
|
36
|
-
def due
|
37
|
-
DEFAULT_DUE_HOURS_PER_DAY * 60 * 60
|
38
|
-
end
|
39
40
|
end
|
40
41
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Ecm::TimeTracking
|
2
|
+
class EntryType < ActiveRecord::Base
|
3
|
+
validates :identifier, presence: true, uniqueness: true
|
4
|
+
validates :due_in_seconds, presence: true
|
5
|
+
|
6
|
+
def due_in_minutes=(due_in_minutes)
|
7
|
+
self.due_in_seconds = due_in_minutes.to_i * 60
|
8
|
+
end
|
9
|
+
|
10
|
+
def due_in_minutes
|
11
|
+
(due_in_seconds || 0) / 60
|
12
|
+
end
|
13
|
+
|
14
|
+
def due_in_hours=(due_in_hours)
|
15
|
+
self.due_in_minutes = due_in_hours.to_i * 60
|
16
|
+
end
|
17
|
+
|
18
|
+
def due_in_hours
|
19
|
+
(due_in_minutes || 0) / 60
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
def human
|
24
|
+
identifier
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/config/locales/de.yml
CHANGED
@@ -6,12 +6,19 @@ de:
|
|
6
6
|
break_length_in_minutes: Pause [Minuten]
|
7
7
|
description: Beschreibung
|
8
8
|
end_at: Bis
|
9
|
+
entry_type: Typ
|
9
10
|
length: Länge
|
10
11
|
overtime: Überzeit
|
11
12
|
tracker: Erfasser
|
12
13
|
created_at: Erstellt am
|
13
14
|
updated_at: Aktualisiert am
|
15
|
+
ecm/time_tracking/entry_type:
|
16
|
+
identifier: Bezeichner
|
17
|
+
due_in_hours: Soll [Stunden]
|
14
18
|
models:
|
15
19
|
ecm/time_tracking/entry:
|
16
20
|
one: Eintrag
|
17
|
-
other: Einträge
|
21
|
+
other: Einträge
|
22
|
+
ecm/time_tracking/entry_type:
|
23
|
+
one: Eintragstyp
|
24
|
+
other: Eintragstypen
|
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.2
|
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-03-
|
11
|
+
date: 2016-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -39,10 +39,12 @@ files:
|
|
39
39
|
- app/controllers/ecm/time_tracking/application_controller.rb
|
40
40
|
- app/helpers/ecm/time_tracking/application_helper.rb
|
41
41
|
- app/models/ecm/time_tracking/entry.rb
|
42
|
+
- app/models/ecm/time_tracking/entry_type.rb
|
42
43
|
- app/views/layouts/ecm/time_tracking/application.html.erb
|
43
44
|
- config/locales/de.yml
|
44
45
|
- config/routes.rb
|
45
46
|
- db/migrate/20160305142931_create_ecm_time_tracking_entries.rb
|
47
|
+
- db/migrate/20160307185539_create_ecm_time_tracking_entry_types.rb
|
46
48
|
- lib/ecm/time_tracking.rb
|
47
49
|
- lib/ecm/time_tracking/configuration.rb
|
48
50
|
- lib/ecm/time_tracking/engine.rb
|