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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f7858a89c71006be1cf675ab74c7ae847c99f05
4
- data.tar.gz: 8d94facde52dcf0974619cac797623dbd90c1632
3
+ metadata.gz: b5c131b35bbb0364d26d38f996943e9be397781c
4
+ data.tar.gz: 9741719c01035c18fd114bb47ddcc0a725722f8b
5
5
  SHA512:
6
- metadata.gz: 1dc4b7c78873ab4e79c8f8dc452c0df02122e164855d4e6af6905bfb8197a7f47aaca837e948891d0b42fcf17ff87c18fa70e9e9ddcb0a3c8da3cf7c5ae499a6
7
- data.tar.gz: 946179cf1484a9db5850bc2d59a27d2d88ae2dc3be88ddd1959f7449d99e19209e555fa5c27b5375c21851f2f5a3259058e0bc63b47a7fdda3f686c08201a1a6
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 - due - (break_length_in_seconds || 0)
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
@@ -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
@@ -2,6 +2,7 @@ class CreateEcmTimeTrackingEntries < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :ecm_time_tracking_entries do |t|
4
4
  t.integer :tracker_id
5
+ t.integer :entry_type_id
5
6
  t.timestamp :begin_at
6
7
  t.timestamp :end_at
7
8
  t.integer :break_length_in_seconds
@@ -0,0 +1,10 @@
1
+ class CreateEcmTimeTrackingEntryTypes < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_time_tracking_entry_types do |t|
4
+ t.string :identifier
5
+ t.integer :due_in_seconds
6
+
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -1,5 +1,5 @@
1
1
  module Ecm
2
2
  module TimeTracking
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  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.1
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-06 00:00:00.000000000 Z
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