ecm_time_tracking 0.0.6 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/concerns/model/flag_from_time_range_concern.rb +26 -0
- data/app/models/ecm/time_tracking/tracker_calculation_schema.rb +23 -0
- data/config/locales/de.yml +11 -1
- data/db/migrate/20160408150646_create_ecm_time_tracking_tracker_calculation_schemas.rb +12 -0
- data/lib/ecm/time_tracking/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a59d111d012cf293b9f1002edd778dd45d2885d2
|
4
|
+
data.tar.gz: 726d79f8bfe0e162577ccf62d430236a584276fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de0ac2e7f7bd23f8fbd136dedd91a00de1dc9ece8d382ce4ae59bdb07e5ce37dfce955956b47c019acbaf8d0fabb05a169654fc61d43e0b1dedd5fa6e1bc6a49
|
7
|
+
data.tar.gz: 326d1a7f0277ed86369c4e504b400bad770509646900104b3bbf7a886d8a8da5cc3a6b422595c32608cedbffd1fb9743b80faecbf73aeacffd9becebdbbbed81
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Model
|
2
|
+
module FlagFromTimeRangeConcern
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
class_methods do
|
6
|
+
def flag_from_time_range(*args)
|
7
|
+
options = args.extract_options!
|
8
|
+
attributes = args
|
9
|
+
|
10
|
+
attributes.each do |attribute|
|
11
|
+
method_name_base = attribute.to_s.chomp('?')
|
12
|
+
define_method attribute do
|
13
|
+
time_range = (send("#{method_name_base}_from")..send("#{method_name_base}_to"))
|
14
|
+
time_range.cover? Time.zone.now
|
15
|
+
end
|
16
|
+
|
17
|
+
define_singleton_method method_name_base do
|
18
|
+
t = arel_table
|
19
|
+
now = Time.zone.now
|
20
|
+
where(t["#{method_name_base}_from"].lteq(now)).where(t["#{method_name_base}_to"].gteq(now))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Ecm::TimeTracking
|
2
|
+
class TrackerCalculationSchema < ActiveRecord::Base
|
3
|
+
module Defaults
|
4
|
+
def self.included(base)
|
5
|
+
base.after_initialize :set_defaults, if: :new_record?
|
6
|
+
end
|
7
|
+
|
8
|
+
def set_defaults
|
9
|
+
self.enabled_from = '01.01.1900 00:00:00'
|
10
|
+
self.enabled_to = '31.12.9999 23:59:59'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
belongs_to :tracker, class_name: Configuration.tracker_class_name, foreign_key: 'tracker_id'
|
15
|
+
|
16
|
+
validates :tracker, :identifier, :enabled_from, :enabled_to, presence: true
|
17
|
+
|
18
|
+
include Defaults
|
19
|
+
|
20
|
+
include Model::FlagFromTimeRangeConcern
|
21
|
+
flag_from_time_range :enabled?
|
22
|
+
end
|
23
|
+
end
|
data/config/locales/de.yml
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
de:
|
2
2
|
activerecord:
|
3
3
|
attributes:
|
4
|
+
ecm/time_tracking/tracker_calculation_schema:
|
5
|
+
tracker: Erfasser
|
6
|
+
identifier: Bezeichner
|
7
|
+
enabled_from: Aktiv von
|
8
|
+
enabled_to: Aktiv bis
|
9
|
+
created_at: Erstellt am
|
10
|
+
updated_at: Aktualisiert am
|
4
11
|
ecm/time_tracking/entry:
|
5
12
|
begin_at: Von
|
6
13
|
break_length_in_minutes: Pause [Minuten]
|
@@ -21,4 +28,7 @@ de:
|
|
21
28
|
other: Einträge
|
22
29
|
ecm/time_tracking/entry_type:
|
23
30
|
one: Eintragstyp
|
24
|
-
other: Eintragstypen
|
31
|
+
other: Eintragstypen
|
32
|
+
ecm/time_tracking/tracker_calculation_schema:
|
33
|
+
one: Berechnungsschema
|
34
|
+
other: Berechnungsschemen
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateEcmTimeTrackingTrackerCalculationSchemas < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :ecm_time_tracking_tracker_calculation_schemas do |t|
|
4
|
+
t.integer :tracker_id
|
5
|
+
t.string :identifier
|
6
|
+
t.timestamp :enabled_from
|
7
|
+
t.timestamp :enabled_to
|
8
|
+
|
9
|
+
t.timestamps null: false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
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.1.0
|
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-
|
11
|
+
date: 2016-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -36,10 +36,12 @@ files:
|
|
36
36
|
- Rakefile
|
37
37
|
- app/assets/javascripts/ecm/time_tracking/application.js
|
38
38
|
- app/assets/stylesheets/ecm/time_tracking/application.css
|
39
|
+
- app/concerns/model/flag_from_time_range_concern.rb
|
39
40
|
- app/controllers/ecm/time_tracking/application_controller.rb
|
40
41
|
- app/helpers/ecm/time_tracking/application_helper.rb
|
41
42
|
- app/models/ecm/time_tracking/entry.rb
|
42
43
|
- app/models/ecm/time_tracking/entry_type.rb
|
44
|
+
- app/models/ecm/time_tracking/tracker_calculation_schema.rb
|
43
45
|
- app/services/ecm/time_tracking/software_developer_sums_service.rb
|
44
46
|
- app/services/ecm/time_tracking/sums_service.rb
|
45
47
|
- app/views/layouts/ecm/time_tracking/application.html.erb
|
@@ -47,6 +49,7 @@ files:
|
|
47
49
|
- config/routes.rb
|
48
50
|
- db/migrate/20160305142931_create_ecm_time_tracking_entries.rb
|
49
51
|
- db/migrate/20160307185539_create_ecm_time_tracking_entry_types.rb
|
52
|
+
- db/migrate/20160408150646_create_ecm_time_tracking_tracker_calculation_schemas.rb
|
50
53
|
- lib/ecm/time_tracking.rb
|
51
54
|
- lib/ecm/time_tracking/configuration.rb
|
52
55
|
- lib/ecm/time_tracking/engine.rb
|