ecom_core 1.2.13 → 1.2.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/ecom/core/{booked_equipment_item.rb → booked_item.rb} +1 -1
- data/app/models/ecom/core/booking.rb +2 -2
- data/app/models/ecom/core/crew_time.rb +45 -17
- data/app/models/ecom/core/product_group.rb +9 -0
- data/app/models/ecom/core/project.rb +1 -1
- data/app/models/ecom/core/task.rb +45 -2
- data/app/models/ecom/core/task_resource.rb +10 -0
- data/app/models/ecom/core/task_template.rb +1 -1
- data/app/models/ecom/core/work_package.rb +12 -0
- data/app/models/ecom/core/work_product.rb +19 -45
- data/app/models/ecom/core/work_product_template.rb +2 -6
- data/app/services/ecom/core/menu_service.rb +1 -1
- data/db/migrate/20191119012030_create_ecom_core_task_templates.rb +2 -0
- data/db/migrate/20191119013236_create_ecom_core_work_product_templates.rb +14 -4
- data/db/migrate/20191201145848_create_ecom_core_projects.rb +2 -2
- data/db/migrate/20191201251015_create_ecom_core_product_groups.rb +13 -0
- data/db/migrate/20191202222210_create_ecom_core_work_packages.rb +17 -0
- data/db/migrate/20191202235434_create_ecom_core_work_products.rb +8 -13
- data/db/migrate/20191207103735_create_ecom_core_tasks.rb +45 -0
- data/db/migrate/20191210724614_create_ecom_core_task_resources.rb +18 -0
- data/db/migrate/20200602830603_create_ecom_core_bookings.rb +0 -4
- data/db/migrate/{20200603115317_create_ecom_core_booked_equipment_items.rb → 20200603115317_create_ecom_core_booked_items.rb} +3 -3
- data/lib/ecom/core/version.rb +1 -1
- data/spec/factories/ecom/core/application_modules.rb +3 -1
- data/spec/factories/ecom/core/{booked_equipment_items.rb → booked_items.rb} +1 -1
- data/spec/factories/ecom/core/bookings.rb +0 -1
- data/spec/factories/ecom/core/companies.rb +3 -1
- data/spec/factories/ecom/core/product_groups.rb +6 -0
- data/spec/factories/ecom/core/projects.rb +1 -1
- data/spec/factories/ecom/core/resource_types.rb +3 -1
- data/spec/factories/ecom/core/task_resources.rb +8 -0
- data/spec/factories/ecom/core/task_template_types.rb +6 -2
- data/spec/factories/ecom/core/task_templates.rb +5 -7
- data/spec/factories/ecom/core/tasks.rb +14 -3
- data/spec/factories/ecom/core/work_packages.rb +12 -0
- data/spec/factories/ecom/core/work_product_templates.rb +7 -4
- data/spec/factories/ecom/core/work_products.rb +5 -7
- metadata +15 -12
- data/app/models/ecom/core/work_component.rb +0 -14
- data/app/models/ecom/core/work_component_template.rb +0 -11
- data/db/migrate/20191201134420_create_ecom_core_work_component_templates.rb +0 -25
- data/db/migrate/20191202103735_create_ecom_core_tasks.rb +0 -20
- data/db/migrate/20191206104247_create_ecom_core_work_components.rb +0 -40
- data/spec/factories/ecom/core/work_component_templates.rb +0 -11
- data/spec/factories/ecom/core/work_components.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faf0a77147b59f982b4e26d123d93a93f7f51daa2f0d47b453df22ceac084f3e
|
4
|
+
data.tar.gz: c7faa1131252a81ac43cbdd8b848c3f66f2db84cf09e64296de3fd7b490e116e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a83643810ff0d997045c7efa28da6a81f2b7c2f9b5a9cc13ed556735ab09559e6e55133f6e9412add7f8d597f1dffe705e195cfe84fa3c09ff0c4ceae5857f29
|
7
|
+
data.tar.gz: b234a2bbcaad56cf90d94d974f0d611497dd9202056cbb3103775d502a156783a52e87d04afd0373bf9c3dc852fc20a395fe0d4f4ce0bdd4fcdb3c8ac796f356
|
@@ -8,9 +8,9 @@ module Ecom
|
|
8
8
|
|
9
9
|
belongs_to :equipment_request
|
10
10
|
belongs_to :booked_by, class_name: 'Ecom::Core::User'
|
11
|
-
|
11
|
+
has_many :booked_items
|
12
12
|
|
13
13
|
validates :status, presence: true, inclusion: STATUSES
|
14
14
|
end
|
15
15
|
end
|
16
|
-
end
|
16
|
+
end
|
@@ -2,15 +2,15 @@ module Ecom
|
|
2
2
|
module Core
|
3
3
|
class CrewTime < ApplicationRecord
|
4
4
|
# Time Ranges
|
5
|
-
MORNING =
|
6
|
-
AFTERNOON =
|
7
|
-
|
5
|
+
MORNING = :morning
|
6
|
+
AFTERNOON = :afternoon
|
7
|
+
FULL_DAY = :full_day
|
8
8
|
|
9
|
-
TIME_RANGE = {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
}.freeze
|
9
|
+
# TIME_RANGE = {
|
10
|
+
# MORNING => { start: Time.zone.parse('5:00 AM'), end: Time.zone.parse('9:00 AM') },
|
11
|
+
# AFTERNOON => { start: Time.zone.parse('10:00 AM'), end: Time.zone.parse('2:00 PM') },
|
12
|
+
# BOTH => { start: Time.zone.parse('5:00 AM'), end: Time.zone.parse('2:00 PM') }
|
13
|
+
# }.freeze
|
14
14
|
|
15
15
|
belongs_to :attendance_sheet_entry
|
16
16
|
belongs_to :revision_to, class_name: 'Ecom::Core::CrewTime', optional: true
|
@@ -47,15 +47,42 @@ module Ecom
|
|
47
47
|
attendance_sheet_entry.save
|
48
48
|
end
|
49
49
|
|
50
|
+
# A method to get the available time ranges at a given point.
|
51
|
+
# We cannot define the range variables as a constant because
|
52
|
+
# the parsing should be done at the exact moment we are about
|
53
|
+
# to do time range calculations to avoid errors caused by date
|
54
|
+
# mismatches
|
55
|
+
def get_range
|
56
|
+
morning = {
|
57
|
+
start: Time.zone.parse('5:00 AM'),
|
58
|
+
finish: Time.zone.parse('9:00 AM')
|
59
|
+
}
|
60
|
+
afternoon = {
|
61
|
+
start: Time.zone.parse('10:00 AM'),
|
62
|
+
finish: Time.zone.parse('2:00 PM')
|
63
|
+
}
|
64
|
+
full_day = {
|
65
|
+
start: Time.zone.parse('5:00 AM'),
|
66
|
+
finish: Time.zone.parse('2:00 PM')
|
67
|
+
}
|
68
|
+
|
69
|
+
{
|
70
|
+
morning: morning,
|
71
|
+
afternoon: afternoon,
|
72
|
+
full_day: full_day
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
50
76
|
# A method to check if checkin and checkout range falls in the morning,
|
51
77
|
# afternoon, or both.
|
52
78
|
def find_range(start, finish)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
79
|
+
range = get_range
|
80
|
+
if start.before?(range[:morning][:finish]) && finish.before?(range[:afternoon][:start])
|
81
|
+
:morning
|
82
|
+
elsif start.after?(range[:morning][:finish]) && finish.after?(range[:afternoon][:start])
|
83
|
+
:afternoon
|
57
84
|
else
|
58
|
-
|
85
|
+
:full_day
|
59
86
|
end
|
60
87
|
end
|
61
88
|
|
@@ -63,13 +90,14 @@ module Ecom
|
|
63
90
|
# of the defined morning and afternoon ranges
|
64
91
|
def compute_hours
|
65
92
|
# Reparse time to avoid errors caused by date differences
|
93
|
+
range = get_range
|
66
94
|
start = Time.zone.parse(checkin_time.strftime('%I:%M%p'))
|
67
95
|
finish = Time.zone.parse(checkout_time.strftime('%I:%M%p'))
|
68
|
-
|
69
|
-
left = start.before?(
|
70
|
-
right = finish.after?(
|
96
|
+
day_part = find_range(start, finish)
|
97
|
+
left = start.before?(range[day_part][:start]) ? range[day_part][:start] : start
|
98
|
+
right = finish.after?(range[day_part][:finish]) ? range[day_part][:finish] : finish
|
71
99
|
time = (right - left) / 1.hour
|
72
|
-
time -= 1 if
|
100
|
+
time -= 1 if day_part == FULL_DAY
|
73
101
|
time
|
74
102
|
end
|
75
103
|
end
|
@@ -5,7 +5,7 @@ module Ecom
|
|
5
5
|
belongs_to :contractor, class_name: 'Ecom::Core::Stakeholder'
|
6
6
|
belongs_to :consultant, class_name: 'Ecom::Core::Stakeholder'
|
7
7
|
belongs_to :project_manager, class_name: 'Ecom::Core::Stakeholder'
|
8
|
-
belongs_to :
|
8
|
+
belongs_to :task_template_type
|
9
9
|
belongs_to :currency
|
10
10
|
belongs_to :company
|
11
11
|
|
@@ -1,10 +1,53 @@
|
|
1
1
|
module Ecom
|
2
2
|
module Core
|
3
3
|
class Task < ApplicationRecord
|
4
|
-
|
4
|
+
include AASM
|
5
|
+
|
6
|
+
has_ancestry
|
7
|
+
|
8
|
+
belongs_to :work_product
|
5
9
|
belongs_to :task_template
|
10
|
+
belongs_to :work_package, optional: true
|
11
|
+
belongs_to :performer, class_name: 'Ecom::Core::User', optional: true
|
12
|
+
belongs_to :approver, class_name: 'Ecom::Core::User', optional: true
|
13
|
+
belongs_to :supervisor, class_name: 'Ecom::Core::User', optional: true
|
14
|
+
belongs_to :quality_controller, class_name: 'Ecom::Core::User', optional: true
|
15
|
+
|
16
|
+
validates :code, :name, :status, :percent_completed, presence: true
|
17
|
+
validates_numericality_of :percent_completed,
|
18
|
+
only_integer: true,
|
19
|
+
greater_than_or_equal_to: 0,
|
20
|
+
less_than_or_equal_to: 100
|
21
|
+
|
22
|
+
scope :by_status, ->(status) { where(status: status) }
|
23
|
+
|
24
|
+
aasm column: 'status' do
|
25
|
+
state :new, initial: true
|
26
|
+
state :in_progress
|
27
|
+
state :submitted
|
28
|
+
state :under_review
|
29
|
+
state :completed
|
30
|
+
|
31
|
+
event :start do
|
32
|
+
transitions from: :new, to: :in_progress
|
33
|
+
end
|
34
|
+
|
35
|
+
event :submit do
|
36
|
+
transitions from: :in_progress, to: :submitted
|
37
|
+
end
|
38
|
+
|
39
|
+
event :review do
|
40
|
+
transitions from: :submitted, to: :under_review
|
41
|
+
end
|
42
|
+
|
43
|
+
event :complete do
|
44
|
+
transitions from: %i[submitted under_review], to: :completed
|
45
|
+
end
|
6
46
|
|
7
|
-
|
47
|
+
event :rework do
|
48
|
+
transitions from: :under_review, to: :in_progress
|
49
|
+
end
|
50
|
+
end
|
8
51
|
end
|
9
52
|
end
|
10
53
|
end
|
@@ -4,7 +4,7 @@ module Ecom
|
|
4
4
|
has_ancestry
|
5
5
|
|
6
6
|
belongs_to :task_template_type
|
7
|
-
|
7
|
+
has_and_belongs_to_many :work_product_templates, join_table: 'ecom_core_task_templates_work_product_templates'
|
8
8
|
has_and_belongs_to_many :resource_types, join_table: 'ecom_core_task_templates_resource_types'
|
9
9
|
|
10
10
|
validates :name, :code, presence: true
|
@@ -17,53 +17,27 @@ module Ecom
|
|
17
17
|
class WorkProduct < ApplicationRecord
|
18
18
|
include AASM
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
belongs_to :performer, class_name: 'Ecom::Core::User'
|
24
|
-
belongs_to :approver, class_name: 'Ecom::Core::User'
|
25
|
-
belongs_to :supervisor, class_name: 'Ecom::Core::User'
|
26
|
-
belongs_to :quality_controller, class_name: 'Ecom::Core::User'
|
27
|
-
|
28
|
-
validates :name, presence: true
|
29
|
-
validates :design_reference_no, uniqueness: true
|
30
|
-
|
31
|
-
aasm column: 'task_status' do
|
32
|
-
state :new, initial: true
|
33
|
-
state :in_progress
|
34
|
-
state :submitted
|
35
|
-
state :under_review
|
36
|
-
state :completed
|
37
|
-
|
38
|
-
event :start do
|
39
|
-
transitions from: :new, to: :in_progress
|
40
|
-
end
|
41
|
-
|
42
|
-
event :submit do
|
43
|
-
transitions from: :in_progress, to: :submitted
|
44
|
-
end
|
20
|
+
NEW = 'New'.freeze
|
21
|
+
UNDER_CONSTRUCTION = 'Under Construction'.freeze
|
22
|
+
COMPLETED = 'Completed'.freeze
|
45
23
|
|
46
|
-
|
47
|
-
transitions from: :submitted, to: :under_review
|
48
|
-
end
|
24
|
+
STATUSES = [NEW, UNDER_CONSTRUCTION, COMPLETED].freeze
|
49
25
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
end
|
66
|
-
end
|
26
|
+
belongs_to :work_product_template
|
27
|
+
belongs_to :project
|
28
|
+
belongs_to :product_group, optional: true
|
29
|
+
belongs_to :approver, class_name: 'Ecom::Core::User', optional: true
|
30
|
+
belongs_to :supervisor, class_name: 'Ecom::Core::User', optional: true
|
31
|
+
belongs_to :quality_controller, class_name: 'Ecom::Core::User', optional: true
|
32
|
+
has_many :tasks
|
33
|
+
|
34
|
+
validates :name, :design_reference_no, :status, :percent_completed, presence: true
|
35
|
+
validates :design_reference_no, uniqueness: { scope: :project_id }
|
36
|
+
validates :status, inclusion: STATUSES
|
37
|
+
validates_numericality_of :percent_completed,
|
38
|
+
only_integer: true,
|
39
|
+
greater_than_or_equal_to: 0,
|
40
|
+
less_than_or_equal_to: 100
|
67
41
|
end
|
68
42
|
end
|
69
43
|
end
|
@@ -2,13 +2,9 @@ module Ecom
|
|
2
2
|
module Core
|
3
3
|
class WorkProductTemplate < ApplicationRecord
|
4
4
|
validates :code, :name, presence: true, uniqueness: true
|
5
|
-
belongs_to :
|
5
|
+
belongs_to :task_template_type
|
6
|
+
has_and_belongs_to_many :task_templates
|
6
7
|
has_many :product_types
|
7
|
-
|
8
|
-
scope :filtered_by_template_type, lambda { |id|
|
9
|
-
joins(:task_template).where('ecom_core_task_templates.task_template_type_id = ?', id)
|
10
|
-
.order(:code)
|
11
|
-
}
|
12
8
|
end
|
13
9
|
end
|
14
10
|
end
|
@@ -7,7 +7,7 @@ module Ecom
|
|
7
7
|
INNER JOIN ecom_core_menus_user_roles MUR ON MUR.menu_id = ecom_core_menus.id
|
8
8
|
INNER JOIN ecom_core_user_roles UR ON MUR.user_role_id = UR.id
|
9
9
|
SQL
|
10
|
-
menu = Menu.joins(join_sql).where('UR.id IN (?)', role_ids).distinct
|
10
|
+
menu = Menu.joins(join_sql).where('UR.id IN (?)', role_ids).order(:id).distinct
|
11
11
|
menu_list = menu.select { |m| m.parent.nil? }.each_with_object([]) do |item, list|
|
12
12
|
list << { id: item.id, text: item.label, iconCss: item.icon, items: [] }
|
13
13
|
end
|
@@ -9,6 +9,8 @@ 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 :fields
|
12
14
|
|
13
15
|
t.timestamps
|
14
16
|
end
|
@@ -4,13 +4,23 @@ class CreateEcomCoreWorkProductTemplates < ActiveRecord::Migration[6.0]
|
|
4
4
|
t.string :code, null: false, unique: true
|
5
5
|
t.string :name, null: false, unique: true
|
6
6
|
t.string :description
|
7
|
-
t.
|
8
|
-
t.references :task_template,
|
7
|
+
t.references :task_template_type,
|
9
8
|
null: false,
|
10
|
-
index: { name: '
|
11
|
-
foreign_key: { to_table: :
|
9
|
+
index: { name: 'wpt_on_ttt_indx' },
|
10
|
+
foreign_key: { to_table: :ecom_core_task_template_types }
|
12
11
|
|
13
12
|
t.timestamps
|
14
13
|
end
|
14
|
+
|
15
|
+
create_table :ecom_core_task_templates_work_product_templates do |t|
|
16
|
+
t.references :task_template,
|
17
|
+
null: false,
|
18
|
+
index: { name: 'ttwpt_on_tt_indx' },
|
19
|
+
foreign_key: { to_table: :ecom_core_task_templates }
|
20
|
+
t.references :work_product_template,
|
21
|
+
null: false,
|
22
|
+
index: { name: 'ttwpt_on_wpt_indx' },
|
23
|
+
foreign_key: { to_table: :ecom_core_work_product_templates }
|
24
|
+
end
|
15
25
|
end
|
16
26
|
end
|
@@ -22,10 +22,10 @@ class CreateEcomCoreProjects < ActiveRecord::Migration[6.0]
|
|
22
22
|
null: false,
|
23
23
|
index: { name: 'employer_on_pm_indx' },
|
24
24
|
foreign_key: { to_table: :ecom_core_stakeholders }
|
25
|
-
t.references :
|
25
|
+
t.references :task_template_type,
|
26
26
|
null: false,
|
27
27
|
index: { name: 'employer_on_tt_indx' },
|
28
|
-
foreign_key: { to_table: :
|
28
|
+
foreign_key: { to_table: :ecom_core_task_template_types }
|
29
29
|
t.string :contract_number, null: false
|
30
30
|
t.date :date_contract_signed, null: false
|
31
31
|
t.date :commencement_date, null: false
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateEcomCoreProductGroups < ActiveRecord::Migration[6.0]
|
2
|
+
def change
|
3
|
+
create_table :ecom_core_product_groups do |t|
|
4
|
+
t.string :name, null: false, unique: true
|
5
|
+
t.references :project,
|
6
|
+
null: false,
|
7
|
+
index: { name: 'pg_on_project_indx' },
|
8
|
+
foreign_key: { to_table: :ecom_core_projects }
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateEcomCoreWorkPackages < ActiveRecord::Migration[6.0]
|
2
|
+
def change
|
3
|
+
create_table :ecom_core_work_packages do |t|
|
4
|
+
t.string :code, null: false, unique: true
|
5
|
+
t.string :name, null: false
|
6
|
+
t.string :description
|
7
|
+
t.date :start_date
|
8
|
+
t.date :end_date
|
9
|
+
t.references :project,
|
10
|
+
null: false,
|
11
|
+
index: { name: 'wp_on_project_indx' },
|
12
|
+
foreign_key: { to_table: :ecom_core_projects }
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,15 +1,14 @@
|
|
1
1
|
class CreateEcomCoreWorkProducts < ActiveRecord::Migration[6.0]
|
2
2
|
def change
|
3
3
|
create_table :ecom_core_work_products do |t|
|
4
|
-
t.string :code, null: false
|
5
4
|
t.string :name, null: false
|
6
5
|
t.string :description
|
7
6
|
t.string :design_reference_no, unique: true
|
8
7
|
t.json :dimension
|
9
|
-
t.references :
|
10
|
-
null:
|
11
|
-
index: { name: '
|
12
|
-
foreign_key: { to_table: :
|
8
|
+
t.references :product_group,
|
9
|
+
null: true,
|
10
|
+
index: { name: 'wp_on_pg_indx' },
|
11
|
+
foreign_key: { to_table: :ecom_core_product_groups }
|
13
12
|
t.references :work_product_template,
|
14
13
|
null: false,
|
15
14
|
index: { name: 'wpt_on_wp_indx' },
|
@@ -18,14 +17,9 @@ class CreateEcomCoreWorkProducts < ActiveRecord::Migration[6.0]
|
|
18
17
|
null: false,
|
19
18
|
index: { name: 'projects_on_wp_indx' },
|
20
19
|
foreign_key: { to_table: :ecom_core_projects }
|
21
|
-
t.string :
|
22
|
-
t.
|
23
|
-
t.integer :percent_completed
|
20
|
+
t.string :status, default: 'New'
|
21
|
+
t.integer :percent_completed, null: false, default: 0
|
24
22
|
t.string :remark
|
25
|
-
t.references :performer,
|
26
|
-
null: true,
|
27
|
-
index: false,
|
28
|
-
foreign_key: { to_table: :ecom_core_users }
|
29
23
|
t.references :approver,
|
30
24
|
null: true,
|
31
25
|
index: false,
|
@@ -40,10 +34,11 @@ class CreateEcomCoreWorkProducts < ActiveRecord::Migration[6.0]
|
|
40
34
|
foreign_key: { to_table: :ecom_core_users }
|
41
35
|
t.datetime :start_date
|
42
36
|
t.datetime :completion_date
|
37
|
+
t.boolean :tasks_generated, null: false, default: false
|
43
38
|
|
44
39
|
t.timestamps
|
45
40
|
end
|
46
41
|
|
47
|
-
add_index :ecom_core_work_products, %i[
|
42
|
+
add_index :ecom_core_work_products, %i[design_reference_no project_id], unique: true, name: 'wp_on_drpi_indx'
|
48
43
|
end
|
49
44
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
class CreateEcomCoreTasks < ActiveRecord::Migration[6.0]
|
2
|
+
def change
|
3
|
+
create_table :ecom_core_tasks do |t|
|
4
|
+
t.string :code, null: false
|
5
|
+
t.string :name, null: false
|
6
|
+
t.string :description
|
7
|
+
t.string :ancestry
|
8
|
+
t.date :start_date
|
9
|
+
t.date :end_date
|
10
|
+
t.string :status, null: false, default: :new
|
11
|
+
t.integer :percent_completed, null: false, default: 0
|
12
|
+
t.string :remark
|
13
|
+
t.references :work_package,
|
14
|
+
null: true,
|
15
|
+
index: { name: 'wp_on_wp_indx' },
|
16
|
+
foreign_key: { to_table: :ecom_core_work_packages }
|
17
|
+
t.references :performer,
|
18
|
+
null: true,
|
19
|
+
index: { name: 'tasks_on_performer_indx' },
|
20
|
+
foreign_key: { to_table: :ecom_core_users }
|
21
|
+
t.references :approver,
|
22
|
+
null: true,
|
23
|
+
index: { name: 'tasks_on_approver_indx' },
|
24
|
+
foreign_key: { to_table: :ecom_core_users }
|
25
|
+
t.references :supervisor,
|
26
|
+
null: true,
|
27
|
+
index: { name: 'tasks_on_supervisor_indx' },
|
28
|
+
foreign_key: { to_table: :ecom_core_users }
|
29
|
+
t.references :quality_controller,
|
30
|
+
null: true,
|
31
|
+
index: { name: 'tasks_on_qc_indx' },
|
32
|
+
foreign_key: { to_table: :ecom_core_users }
|
33
|
+
t.references :work_product,
|
34
|
+
null: false,
|
35
|
+
index: { name: 'tasks_on_wp_indx' },
|
36
|
+
foreign_key: { to_table: :ecom_core_work_products }
|
37
|
+
t.references :task_template,
|
38
|
+
null: false,
|
39
|
+
index: { name: 'tt_on_project_indx' },
|
40
|
+
foreign_key: { to_table: :ecom_core_task_templates }
|
41
|
+
|
42
|
+
t.timestamps
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateEcomCoreTaskResources < ActiveRecord::Migration[6.0]
|
2
|
+
def change
|
3
|
+
create_table :ecom_core_task_resources do |t|
|
4
|
+
t.references :task,
|
5
|
+
null: false,
|
6
|
+
index: { name: 'tr_on_task_indx' },
|
7
|
+
foreign_key: { to_table: :ecom_core_tasks }
|
8
|
+
t.references :resource_type,
|
9
|
+
null: false,
|
10
|
+
index: { name: 'tr_on_rt_indx' },
|
11
|
+
foreign_key: { to_table: :ecom_core_resource_types }
|
12
|
+
t.date :date_assigned
|
13
|
+
t.float :amount, nullable: false
|
14
|
+
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -9,10 +9,6 @@ class CreateEcomCoreBookings < ActiveRecord::Migration[6.0]
|
|
9
9
|
null: false,
|
10
10
|
index: { name: 'er_on_bb_indx' },
|
11
11
|
foreign_key: { to_table: :ecom_core_users }
|
12
|
-
t.references :booked_for,
|
13
|
-
null: false,
|
14
|
-
index: { name: 'booking_on_bf_indx' },
|
15
|
-
foreign_key: { to_table: :ecom_core_users }
|
16
12
|
t.string :remark
|
17
13
|
t.string :status, null: false
|
18
14
|
|
@@ -1,6 +1,6 @@
|
|
1
|
-
class
|
1
|
+
class CreateEcomCoreBookedItems < ActiveRecord::Migration[6.0]
|
2
2
|
def change
|
3
|
-
create_table :
|
3
|
+
create_table :ecom_core_booked_items do |t|
|
4
4
|
t.references :booking,
|
5
5
|
null: false,
|
6
6
|
index: { name: 'bei_on_booking_indx' },
|
@@ -8,7 +8,7 @@ class CreateEcomCoreBookedEquipmentItems < ActiveRecord::Migration[6.0]
|
|
8
8
|
t.references :requested_item,
|
9
9
|
null: false,
|
10
10
|
index: { name: 'bei_on_ri_indx' },
|
11
|
-
|
11
|
+
foreign_key: { to_table: :ecom_core_requested_items }
|
12
12
|
t.references :equipment_item,
|
13
13
|
null: false,
|
14
14
|
index: { name: 'be_on_ei_indx' },
|
data/lib/ecom/core/version.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :company, class: Ecom::Core::Company do
|
3
|
-
code
|
3
|
+
sequence :code do |n|
|
4
|
+
"CCode#{n}"
|
5
|
+
end
|
4
6
|
name { FFaker::Name.name }
|
5
7
|
address { FFaker::Address.street_address }
|
6
8
|
telephone { FFaker::PhoneNumber.phone_number }
|
@@ -9,7 +9,7 @@ FactoryBot.define do
|
|
9
9
|
association :contractor, factory: :stakeholder
|
10
10
|
association :consultant, factory: :stakeholder
|
11
11
|
association :project_manager, factory: :stakeholder
|
12
|
-
association :
|
12
|
+
association :task_template_type
|
13
13
|
contract_number { FFaker::Name.name }
|
14
14
|
date_contract_signed { 30.days.ago }
|
15
15
|
commencement_date { 1.day.ago }
|
@@ -1,6 +1,10 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :task_template_type, class: Ecom::Core::TaskTemplateType do
|
3
|
-
code
|
4
|
-
|
3
|
+
sequence :code do |n|
|
4
|
+
"TTTCode#{n}"
|
5
|
+
end
|
6
|
+
sequence :name do |n|
|
7
|
+
"TTTName#{n}"
|
8
|
+
end
|
5
9
|
end
|
6
10
|
end
|
@@ -1,14 +1,12 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :task_template, class: Ecom::Core::TaskTemplate do
|
3
|
-
code
|
3
|
+
sequence :code do |n|
|
4
|
+
"TTCode#{n}"
|
5
|
+
end
|
4
6
|
name { FFaker::Name.name }
|
5
7
|
description { FFaker::Name.name }
|
6
8
|
association :task_template_type
|
7
|
-
|
8
|
-
|
9
|
-
after :create do |task_template, _|
|
10
|
-
create(:work_product_template, task_template: task_template)
|
11
|
-
end
|
12
|
-
end
|
9
|
+
has_takeoff_fields { false }
|
10
|
+
fields { [{ name: 'length', label: 'Length' }] }
|
13
11
|
end
|
14
12
|
end
|
@@ -1,10 +1,21 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :task, class: Ecom::Core::Task do
|
3
|
-
code
|
3
|
+
sequence :code do |n|
|
4
|
+
"TCode#{n}"
|
5
|
+
end
|
4
6
|
name { FFaker::Name.name }
|
5
7
|
description { FFaker::Name.name }
|
6
|
-
|
7
|
-
|
8
|
+
start_date { Date.yesterday }
|
9
|
+
end_date { Date.today }
|
10
|
+
status { :new }
|
11
|
+
percent_completed { 0 }
|
12
|
+
remark { FFaker::Name.name }
|
13
|
+
association :performer, factory: :user
|
14
|
+
association :approver, factory: :user
|
15
|
+
association :supervisor, factory: :user
|
16
|
+
association :quality_controller, factory: :user
|
8
17
|
association :task_template
|
18
|
+
association :work_product
|
19
|
+
association :work_package
|
9
20
|
end
|
10
21
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :work_package, class: Ecom::Core::WorkPackage do
|
3
|
+
sequence :code do |n|
|
4
|
+
"WPCode#{n}"
|
5
|
+
end
|
6
|
+
name { FFaker::Name.name }
|
7
|
+
description { FFaker::Name.name }
|
8
|
+
start_date { Date.yesterday }
|
9
|
+
end_date { Date.today }
|
10
|
+
association :project
|
11
|
+
end
|
12
|
+
end
|
@@ -1,9 +1,12 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :work_product_template, class: Ecom::Core::WorkProductTemplate do
|
3
|
-
code
|
4
|
-
|
3
|
+
sequence :code do |n|
|
4
|
+
"Code#{n}"
|
5
|
+
end
|
6
|
+
sequence :name do |n|
|
7
|
+
"Name#{n}"
|
8
|
+
end
|
5
9
|
description { FFaker::Name.name }
|
6
|
-
|
7
|
-
association :task_template
|
10
|
+
association :task_template_type
|
8
11
|
end
|
9
12
|
end
|
@@ -1,22 +1,20 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :work_product, class: Ecom::Core::WorkProduct do
|
3
|
-
|
4
|
-
name { FFaker::Name.unique.name }
|
3
|
+
name { FFaker::Name.name }
|
5
4
|
description { FFaker::Name.name }
|
6
|
-
design_reference_no { FFaker::
|
5
|
+
design_reference_no { FFaker::Guid.guid }
|
7
6
|
dimension { [{ label: 'Length', name: 'length', value: 12 }] }
|
8
|
-
association :
|
7
|
+
association :product_group
|
9
8
|
association :work_product_template
|
10
9
|
association :project
|
11
|
-
|
12
|
-
task_status { :new }
|
10
|
+
status { Ecom::Core::WorkProduct::NEW }
|
13
11
|
percent_completed { FFaker::Random.rand(1..100) }
|
14
12
|
remark { FFaker::Name.name }
|
15
|
-
association :performer, factory: :user
|
16
13
|
association :approver, factory: :user
|
17
14
|
association :supervisor, factory: :user
|
18
15
|
association :quality_controller, factory: :user
|
19
16
|
start_date { 1.day.ago }
|
20
17
|
completion_date { Time.now.next_week }
|
18
|
+
tasks_generated { false }
|
21
19
|
end
|
22
20
|
end
|
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.2.
|
4
|
+
version: 1.2.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aasm
|
@@ -205,7 +205,7 @@ files:
|
|
205
205
|
- app/models/ecom/core/application_record.rb
|
206
206
|
- app/models/ecom/core/attendance_sheet.rb
|
207
207
|
- app/models/ecom/core/attendance_sheet_entry.rb
|
208
|
-
- app/models/ecom/core/
|
208
|
+
- app/models/ecom/core/booked_item.rb
|
209
209
|
- app/models/ecom/core/booking.rb
|
210
210
|
- app/models/ecom/core/company.rb
|
211
211
|
- app/models/ecom/core/component_type.rb
|
@@ -234,6 +234,7 @@ files:
|
|
234
234
|
- app/models/ecom/core/payment.rb
|
235
235
|
- app/models/ecom/core/payment_detail.rb
|
236
236
|
- app/models/ecom/core/payroll.rb
|
237
|
+
- app/models/ecom/core/product_group.rb
|
237
238
|
- app/models/ecom/core/product_type.rb
|
238
239
|
- app/models/ecom/core/project.rb
|
239
240
|
- app/models/ecom/core/project_crew.rb
|
@@ -242,12 +243,12 @@ files:
|
|
242
243
|
- app/models/ecom/core/stakeholder.rb
|
243
244
|
- app/models/ecom/core/stakeholder_type.rb
|
244
245
|
- app/models/ecom/core/task.rb
|
246
|
+
- app/models/ecom/core/task_resource.rb
|
245
247
|
- app/models/ecom/core/task_template.rb
|
246
248
|
- app/models/ecom/core/task_template_type.rb
|
247
249
|
- app/models/ecom/core/user.rb
|
248
250
|
- app/models/ecom/core/user_role.rb
|
249
|
-
- app/models/ecom/core/
|
250
|
-
- app/models/ecom/core/work_component_template.rb
|
251
|
+
- app/models/ecom/core/work_package.rb
|
251
252
|
- app/models/ecom/core/work_product.rb
|
252
253
|
- app/models/ecom/core/work_product_template.rb
|
253
254
|
- app/serializers/ecom/core/application_module_serializer.rb
|
@@ -270,17 +271,18 @@ files:
|
|
270
271
|
- db/migrate/20191119144618_create_ecom_core_stakeholders.rb
|
271
272
|
- db/migrate/20191119145711_create_ecom_core_resource_types.rb
|
272
273
|
- db/migrate/20191201131341_create_ecom_core_product_types.rb
|
273
|
-
- db/migrate/20191201134420_create_ecom_core_work_component_templates.rb
|
274
274
|
- db/migrate/20191201145816_create_ecom_core_currencies.rb
|
275
275
|
- db/migrate/20191201145848_create_ecom_core_projects.rb
|
276
|
-
- db/migrate/
|
276
|
+
- db/migrate/20191201251015_create_ecom_core_product_groups.rb
|
277
277
|
- db/migrate/20191202105355_create_task_templates_resource_types.rb
|
278
278
|
- db/migrate/20191202220752_create_ecom_core_application_modules.rb
|
279
279
|
- db/migrate/20191202220832_create_ecom_core_users.rb
|
280
280
|
- db/migrate/20191202220953_create_ecom_core_user_roles.rb
|
281
281
|
- db/migrate/20191202221423_create_ecom_core_menus.rb
|
282
|
+
- db/migrate/20191202222210_create_ecom_core_work_packages.rb
|
282
283
|
- db/migrate/20191202235434_create_ecom_core_work_products.rb
|
283
|
-
- db/migrate/
|
284
|
+
- db/migrate/20191207103735_create_ecom_core_tasks.rb
|
285
|
+
- db/migrate/20191210724614_create_ecom_core_task_resources.rb
|
284
286
|
- db/migrate/20191225100054_create_ecom_core_crews.rb
|
285
287
|
- db/migrate/20191225121850_create_ecom_core_project_crews.rb
|
286
288
|
- db/migrate/20191225140433_create_ecom_core_attendance_sheets.rb
|
@@ -302,7 +304,7 @@ files:
|
|
302
304
|
- db/migrate/20200601104719_create_ecom_core_equipment_requests.rb
|
303
305
|
- db/migrate/20200602130247_create_ecom_core_requested_items.rb
|
304
306
|
- db/migrate/20200602830603_create_ecom_core_bookings.rb
|
305
|
-
- db/migrate/
|
307
|
+
- db/migrate/20200603115317_create_ecom_core_booked_items.rb
|
306
308
|
- lib/ecom/core.rb
|
307
309
|
- lib/ecom/core/engine.rb
|
308
310
|
- lib/ecom/core/version.rb
|
@@ -311,7 +313,7 @@ files:
|
|
311
313
|
- spec/factories/ecom/core/application_modules.rb
|
312
314
|
- spec/factories/ecom/core/attendance_sheet_entries.rb
|
313
315
|
- spec/factories/ecom/core/attendance_sheets.rb
|
314
|
-
- spec/factories/ecom/core/
|
316
|
+
- spec/factories/ecom/core/booked_items.rb
|
315
317
|
- spec/factories/ecom/core/bookings.rb
|
316
318
|
- spec/factories/ecom/core/companies.rb
|
317
319
|
- spec/factories/ecom/core/component_types.rb
|
@@ -340,6 +342,7 @@ files:
|
|
340
342
|
- spec/factories/ecom/core/payment_details.rb
|
341
343
|
- spec/factories/ecom/core/payments.rb
|
342
344
|
- spec/factories/ecom/core/payrolls.rb
|
345
|
+
- spec/factories/ecom/core/product_groups.rb
|
343
346
|
- spec/factories/ecom/core/product_types.rb
|
344
347
|
- spec/factories/ecom/core/project_crews.rb
|
345
348
|
- spec/factories/ecom/core/projects.rb
|
@@ -347,13 +350,13 @@ files:
|
|
347
350
|
- spec/factories/ecom/core/resource_types.rb
|
348
351
|
- spec/factories/ecom/core/stakeholder_types.rb
|
349
352
|
- spec/factories/ecom/core/stakeholders.rb
|
353
|
+
- spec/factories/ecom/core/task_resources.rb
|
350
354
|
- spec/factories/ecom/core/task_template_types.rb
|
351
355
|
- spec/factories/ecom/core/task_templates.rb
|
352
356
|
- spec/factories/ecom/core/tasks.rb
|
353
357
|
- spec/factories/ecom/core/user_roles.rb
|
354
358
|
- spec/factories/ecom/core/users.rb
|
355
|
-
- spec/factories/ecom/core/
|
356
|
-
- spec/factories/ecom/core/work_components.rb
|
359
|
+
- spec/factories/ecom/core/work_packages.rb
|
357
360
|
- spec/factories/ecom/core/work_product_templates.rb
|
358
361
|
- spec/factories/ecom/core/work_products.rb
|
359
362
|
homepage: http://www.mks.com.et
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module Ecom
|
2
|
-
module Core
|
3
|
-
class WorkComponent < ApplicationRecord
|
4
|
-
belongs_to :performer, class_name: 'Ecom::Core::User'
|
5
|
-
belongs_to :approver, class_name: 'Ecom::Core::User'
|
6
|
-
belongs_to :supervisor, class_name: 'Ecom::Core::User'
|
7
|
-
belongs_to :quality_controller, class_name: 'Ecom::Core::User'
|
8
|
-
belongs_to :work_component_template
|
9
|
-
belongs_to :work_product
|
10
|
-
|
11
|
-
validates :name, :assignment_status, :task_status, :percent_completed, presence: true
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
module Ecom
|
2
|
-
module Core
|
3
|
-
class WorkComponentTemplate < ApplicationRecord
|
4
|
-
belongs_to :work_product_template
|
5
|
-
belongs_to :task_template
|
6
|
-
|
7
|
-
validates :code, :name, presence: true
|
8
|
-
validates :code, uniqueness: { scope: %i[work_product_template_id task_template_id] }
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
class CreateEcomCoreWorkComponentTemplates < ActiveRecord::Migration[6.0]
|
2
|
-
def change
|
3
|
-
create_table :ecom_core_work_component_templates do |t|
|
4
|
-
t.string :code, null: false
|
5
|
-
t.string :name, null: false
|
6
|
-
t.string :description
|
7
|
-
t.integer :relative_percentage
|
8
|
-
t.json :dimension
|
9
|
-
t.references :work_product_template,
|
10
|
-
null: false,
|
11
|
-
index: { name: 'wct_on_wpt_indx' },
|
12
|
-
foreign_key: { to_table: :ecom_core_work_product_templates }
|
13
|
-
t.references :task_template,
|
14
|
-
null: false,
|
15
|
-
index: { name: 'wct_on_tt_indx' },
|
16
|
-
foreign_key: { to_table: :ecom_core_task_templates }
|
17
|
-
|
18
|
-
t.timestamps
|
19
|
-
end
|
20
|
-
|
21
|
-
add_index :ecom_core_work_component_templates, %i[code work_product_template_id task_template_id],
|
22
|
-
unique: true,
|
23
|
-
name: 'wct_on_code_wpt_id_tt_id_indx'
|
24
|
-
end
|
25
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
class CreateEcomCoreTasks < ActiveRecord::Migration[6.0]
|
2
|
-
def change
|
3
|
-
create_table :ecom_core_tasks do |t|
|
4
|
-
t.string :code, null: false
|
5
|
-
t.string :name, null: false
|
6
|
-
t.string :description
|
7
|
-
t.string :ancestry
|
8
|
-
t.references :project,
|
9
|
-
null: false,
|
10
|
-
index: { name: 'tasks_on_project_indx' },
|
11
|
-
foreign_key: { to_table: :ecom_core_projects }
|
12
|
-
t.references :task_template,
|
13
|
-
null: false,
|
14
|
-
index: { name: 'tt_on_project_indx' },
|
15
|
-
foreign_key: { to_table: :ecom_core_task_templates }
|
16
|
-
|
17
|
-
t.timestamps
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
class CreateEcomCoreWorkComponents < ActiveRecord::Migration[6.0]
|
2
|
-
def change
|
3
|
-
create_table :ecom_core_work_components do |t|
|
4
|
-
t.string :name, null: false
|
5
|
-
t.json :dimension
|
6
|
-
t.string :assignment_status, null: false, default: :unassigned
|
7
|
-
t.string :task_status, null: false, default: :new
|
8
|
-
t.integer :percent_completed, null: false, default: 0
|
9
|
-
t.string :remark
|
10
|
-
t.references :performer,
|
11
|
-
null: true,
|
12
|
-
index: false,
|
13
|
-
foreign_key: { to_table: :ecom_core_users }
|
14
|
-
t.references :approver,
|
15
|
-
null: true,
|
16
|
-
index: false,
|
17
|
-
foreign_key: { to_table: :ecom_core_users }
|
18
|
-
t.references :supervisor,
|
19
|
-
null: true,
|
20
|
-
index: false,
|
21
|
-
foreign_key: { to_table: :ecom_core_users }
|
22
|
-
t.references :quality_controller,
|
23
|
-
null: true,
|
24
|
-
index: false,
|
25
|
-
foreign_key: { to_table: :ecom_core_users }
|
26
|
-
t.date :start_date
|
27
|
-
t.date :completion_date
|
28
|
-
t.references :work_component_template,
|
29
|
-
null: false,
|
30
|
-
index: { name: 'wct_on_wc_indx' },
|
31
|
-
foreign_key: { to_table: :ecom_core_work_component_templates }
|
32
|
-
t.references :work_product,
|
33
|
-
null: false,
|
34
|
-
index: { name: 'wp_on_wc_indx' },
|
35
|
-
foreign_key: { to_table: :ecom_core_work_products }
|
36
|
-
|
37
|
-
t.timestamps
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
FactoryBot.define do
|
2
|
-
factory :work_component_template, class: Ecom::Core::WorkComponentTemplate do
|
3
|
-
code { FFaker::Name.name }
|
4
|
-
name { FFaker::Name.name }
|
5
|
-
description { FFaker::Name.name }
|
6
|
-
relative_percentage { FFaker::Random.rand(0..100) }
|
7
|
-
dimension { [{ label: 'Length', name: 'length' }, { label: 'Width', name: 'width' }] }
|
8
|
-
association :work_product_template
|
9
|
-
association :task_template
|
10
|
-
end
|
11
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
FactoryBot.define do
|
2
|
-
factory :work_component, class: Ecom::Core::WorkComponent do
|
3
|
-
name { FFaker::Name.name }
|
4
|
-
dimension { [{ label: 'Length', name: 'length', value: 10 }] }
|
5
|
-
assignment_status { :unassigned }
|
6
|
-
task_status { :new }
|
7
|
-
percent_completed { FFaker::Random.rand(1..100) }
|
8
|
-
remark { FFaker::Name.name }
|
9
|
-
association :performer, factory: :user
|
10
|
-
association :approver, factory: :user
|
11
|
-
association :supervisor, factory: :user
|
12
|
-
association :quality_controller, factory: :user
|
13
|
-
start_date { 1.day.ago }
|
14
|
-
completion_date { Time.now.next_week }
|
15
|
-
association :work_component_template
|
16
|
-
association :work_product
|
17
|
-
end
|
18
|
-
end
|