ecom_core 1.3.3 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/ecom/core/attendance_sheet_entry.rb +2 -0
- data/app/models/ecom/core/crew_overtime.rb +9 -2
- data/app/models/ecom/core/crew_time.rb +23 -3
- data/app/models/ecom/core/maintenance_service_order.rb +2 -2
- data/app/models/ecom/core/overtime_sheet_entry.rb +2 -0
- data/app/models/ecom/core/payment_detail.rb +1 -1
- data/app/models/ecom/core/task_template.rb +1 -1
- data/app/services/ecom/core/filter_service.rb +19 -0
- data/db/migrate/20191119012030_create_ecom_core_task_templates.rb +3 -3
- data/db/migrate/20200410111827_create_ecom_core_crew_overtimes.rb +1 -0
- data/db/migrate/20200919081338_create_ecom_core_maintenance_service_orders.rb +2 -2
- data/db/migrate/20201013094100_create_ecom_core_crew_id_cards.rb +1 -1
- data/lib/ecom/core/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94e3027df94f50f9f3c06ccd90f7db0656503d24548f9ba4f13a5e08f64d4bfa
|
4
|
+
data.tar.gz: f322acc0c157ceb5b7e2e39a80bde80cf8b94c6fb6cee08fb3fedf60b918e01d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c722a056f2070704bac09ffc3fe964d38216de5d172609898697a25f6be90f98a280dbaa53a80d29c7457d81318849b8b05dbc997425c9addd169fa48b9b6b2
|
7
|
+
data.tar.gz: 44603efa47b064f655e000080a954df972ddc3125389b143343f95f3c9127588130b1de450978d39530b886a18ac37598072e7c3f946667cbb9bcd457852e662
|
@@ -10,6 +10,10 @@ module Ecom
|
|
10
10
|
|
11
11
|
validates :hours, :raw_hours, presence: true
|
12
12
|
validate :validate_overtime_by_type
|
13
|
+
validates :hours, presence: true, numericality: { greater_than_or_equal_to: 0 }
|
14
|
+
validates :overtime_type_id,
|
15
|
+
uniqueness: { scope: :overtime_sheet_entry_id,
|
16
|
+
message: 'There exists a crew overtime for the given overtime sheet and overtime type' }
|
13
17
|
|
14
18
|
scope :by_overtime, lambda { |id|
|
15
19
|
joins(:overtime_sheet_entry).where(ecom_core_overtime_sheet_entries: { overtime_sheet_id: id })
|
@@ -23,8 +27,11 @@ module Ecom
|
|
23
27
|
|
24
28
|
start = Time.zone.parse(overtime_type.from)
|
25
29
|
finish = Time.zone.parse(overtime_type.to)
|
26
|
-
diff =
|
27
|
-
|
30
|
+
diff = if finish >= start
|
31
|
+
((finish - start) / 3600).round
|
32
|
+
else
|
33
|
+
((start - finish) / 3600).round
|
34
|
+
end
|
28
35
|
return unless raw_hours > diff
|
29
36
|
|
30
37
|
errors.add(:crew_overtime, 'The selected overtime type does not allow the specified amount of hours.')
|
@@ -13,6 +13,7 @@ module Ecom
|
|
13
13
|
|
14
14
|
validates :checkin_time, presence: true, if: :checkout_time
|
15
15
|
validate :time_range_validation, :total_time_validation
|
16
|
+
validates :hours, presence: true, numericality: { greater_than_or_equal_to: 0 }
|
16
17
|
|
17
18
|
scope :by_attendance, lambda { |id|
|
18
19
|
joins(:attendance_sheet_entry).where(ecom_core_attendance_sheet_entries: { attendance_sheet_id: id })
|
@@ -31,9 +32,13 @@ module Ecom
|
|
31
32
|
def total_time_validation
|
32
33
|
return if checkout_time.nil? || checkin_time.nil?
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
if new_record? & !persisted?
|
36
|
+
if attendance_sheet_entry.total_hours + compute_hours > 8
|
37
|
+
errors.add(:attendance_sheet_entry, 'has more than 8 hours')
|
38
|
+
end
|
39
|
+
elsif attendance_sheet_entry.total_hours + compute_hours - computed_hour > 8
|
40
|
+
errors.add(:attendance_sheet_entry, 'has more than 8 hours')
|
41
|
+
end
|
37
42
|
end
|
38
43
|
|
39
44
|
def calculate_hours
|
@@ -109,6 +114,21 @@ module Ecom
|
|
109
114
|
time -= 1 if day_part == FULL_DAY
|
110
115
|
time
|
111
116
|
end
|
117
|
+
|
118
|
+
# A similar method as `compute_hours` but this one computes hours for
|
119
|
+
# the the currently presisted checkin_time and checkout_time
|
120
|
+
def computed_hour
|
121
|
+
# Reparse time to avoid errors caused by date differences
|
122
|
+
range = define_range
|
123
|
+
start = Time.zone.parse(checkin_time_was.strftime('%I:%M%p'))
|
124
|
+
finish = Time.zone.parse(checkout_time_was.strftime('%I:%M%p'))
|
125
|
+
day_part = find_range(start, finish)
|
126
|
+
left = start.before?(range[day_part][:start]) ? range[day_part][:start] : start
|
127
|
+
right = finish.after?(range[day_part][:finish]) ? range[day_part][:finish] : finish
|
128
|
+
time = (right - left) / 1.hour
|
129
|
+
time -= 1 if day_part == FULL_DAY
|
130
|
+
time
|
131
|
+
end
|
112
132
|
end
|
113
133
|
end
|
114
134
|
end
|
@@ -10,9 +10,9 @@ module Ecom
|
|
10
10
|
belongs_to :equipment_item
|
11
11
|
belongs_to :maintenance_type
|
12
12
|
belongs_to :prepared_by, class_name: 'Ecom::Core::User'
|
13
|
-
belongs_to :approved_by, class_name: 'Ecom::Core::User'
|
13
|
+
belongs_to :approved_by, class_name: 'Ecom::Core::User', optional: true
|
14
14
|
|
15
|
-
validates :title, :status,
|
15
|
+
validates :title, :status, presence: true
|
16
16
|
validates :status, inclusion: STATUSES
|
17
17
|
end
|
18
18
|
end
|
@@ -5,7 +5,7 @@ module Ecom
|
|
5
5
|
belongs_to :payment
|
6
6
|
|
7
7
|
validates :hours, :ot_hours, :base_salary, :overtime, :gross_salary, :tax, :pension, :net_salary, :net_pay,
|
8
|
-
:advance, presence: true
|
8
|
+
:advance, presence: true, numericality: { greater_than_or_equal_to: 0 }
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -11,7 +11,7 @@ module Ecom
|
|
11
11
|
has_many :work_product_templates, through: :project_work_item_templates
|
12
12
|
has_and_belongs_to_many :resource_types, join_table: 'ecom_core_task_templates_resource_types'
|
13
13
|
|
14
|
-
validates :name, :code,
|
14
|
+
validates :name, :code, presence: true
|
15
15
|
validates :code, uniqueness: true
|
16
16
|
validates :percentage_contribution,
|
17
17
|
numericality: {
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Ecom
|
2
|
+
module Core
|
3
|
+
class FilterService
|
4
|
+
def get_filtered_data(type, filters)
|
5
|
+
positive = {}
|
6
|
+
negative = {}
|
7
|
+
obj = type.constantize
|
8
|
+
filters.each { |f|
|
9
|
+
if f[:cond] == 'P'
|
10
|
+
positive[f[:key]] = f[:value]
|
11
|
+
else
|
12
|
+
negative[f[:key]] = f[:value]
|
13
|
+
end
|
14
|
+
}
|
15
|
+
obj.where(positive).where.not(negative)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -9,13 +9,13 @@ class CreateEcomCoreTaskTemplates < ActiveRecord::Migration[6.0]
|
|
9
9
|
index: { name: 'tt_on_ttt_indx' },
|
10
10
|
foreign_key: { to_table: :ecom_core_task_template_types }
|
11
11
|
t.string :ancestry, index: true
|
12
|
-
t.boolean :has_takeoff_fields, null:false, default: false
|
13
|
-
t.jsonb :takeoff_fields, null:
|
12
|
+
t.boolean :has_takeoff_fields, null: false, default: false
|
13
|
+
t.jsonb :takeoff_fields, null: true
|
14
14
|
t.integer :percentage_contribution
|
15
15
|
t.integer :task_sequence
|
16
16
|
t.boolean :has_inspection, null: false, default: false
|
17
17
|
t.boolean :discipline, null: false, default: false
|
18
|
-
t.jsonb :task_completion_detail, null:
|
18
|
+
t.jsonb :task_completion_detail, null: true
|
19
19
|
|
20
20
|
t.timestamps
|
21
21
|
end
|
@@ -8,7 +8,7 @@ class CreateEcomCoreMaintenanceServiceOrders < ActiveRecord::Migration[6.0]
|
|
8
8
|
t.boolean :approved, default: false
|
9
9
|
t.string :status, null: false, default: 'New'
|
10
10
|
t.string :remark
|
11
|
-
t.float :current_reading, null:
|
11
|
+
t.float :current_reading, null: true
|
12
12
|
t.references :equipment_item,
|
13
13
|
null: false,
|
14
14
|
index: { name: 'mso_on_ei_indx' },
|
@@ -22,7 +22,7 @@ class CreateEcomCoreMaintenanceServiceOrders < ActiveRecord::Migration[6.0]
|
|
22
22
|
index: { name: 'mso_on_pb_indx' },
|
23
23
|
foreign_key: { to_table: :ecom_core_users }
|
24
24
|
t.references :approved_by,
|
25
|
-
null:
|
25
|
+
null: true,
|
26
26
|
index: { name: 'mso_on_ab_indx' },
|
27
27
|
foreign_key: { to_table: :ecom_core_users }
|
28
28
|
|
@@ -8,7 +8,7 @@ class CreateEcomCoreCrewIdCards < ActiveRecord::Migration[6.0]
|
|
8
8
|
|
9
9
|
t.datetime :issued_on, null: false
|
10
10
|
t.datetime :valid_until, null: false
|
11
|
-
t.string :status, null: false, default: '
|
11
|
+
t.string :status, null: false, default: 'Valid'
|
12
12
|
|
13
13
|
t.timestamps
|
14
14
|
end
|
data/lib/ecom/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecom_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aasm
|
@@ -134,14 +134,14 @@ dependencies:
|
|
134
134
|
requirements:
|
135
135
|
- - "~>"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: 6.
|
137
|
+
version: 6.1.1
|
138
138
|
type: :runtime
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: 6.
|
144
|
+
version: 6.1.1
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: json-schema
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -375,6 +375,7 @@ files:
|
|
375
375
|
- app/serializers/ecom/core/user_role_serializer.rb
|
376
376
|
- app/serializers/ecom/core/user_serializer.rb
|
377
377
|
- app/services/ecom/core/crew_contract_transaction_service.rb
|
378
|
+
- app/services/ecom/core/filter_service.rb
|
378
379
|
- app/services/ecom/core/menu_service.rb
|
379
380
|
- app/services/ecom/core/site_crew_service.rb
|
380
381
|
- app/services/ecom/core/token_auth_service.rb
|
@@ -556,7 +557,7 @@ homepage: http://www.mks.com.et
|
|
556
557
|
licenses:
|
557
558
|
- MIT
|
558
559
|
metadata: {}
|
559
|
-
post_install_message:
|
560
|
+
post_install_message:
|
560
561
|
rdoc_options: []
|
561
562
|
require_paths:
|
562
563
|
- lib
|
@@ -572,7 +573,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
572
573
|
version: '0'
|
573
574
|
requirements: []
|
574
575
|
rubygems_version: 3.1.4
|
575
|
-
signing_key:
|
576
|
+
signing_key:
|
576
577
|
specification_version: 4
|
577
578
|
summary: Core engine for construction management application.
|
578
579
|
test_files: []
|