ecom_core 1.2.5 → 1.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/ecom/core/attendance_sheet.rb +24 -19
  3. data/app/models/ecom/core/attendance_sheet_entry.rb +1 -1
  4. data/app/models/ecom/core/company.rb +10 -0
  5. data/app/models/ecom/core/crew.rb +0 -2
  6. data/app/models/ecom/core/crew_overtime.rb +1 -1
  7. data/app/models/ecom/core/crew_time.rb +0 -3
  8. data/app/models/ecom/core/overtime_sheet.rb +13 -10
  9. data/app/models/ecom/core/payment_detail.rb +1 -1
  10. data/app/models/ecom/core/payroll.rb +1 -0
  11. data/app/models/ecom/core/project.rb +4 -0
  12. data/app/models/ecom/core/project_crew.rb +15 -0
  13. data/db/migrate/20190101085530_create_ecom_core_companies.rb +14 -0
  14. data/db/migrate/20191119012030_create_ecom_core_task_templates.rb +4 -3
  15. data/db/migrate/20191119013236_create_ecom_core_work_product_templates.rb +4 -3
  16. data/db/migrate/20191119144618_create_ecom_core_stakeholders.rb +4 -3
  17. data/db/migrate/20191201131341_create_ecom_core_product_types.rb +4 -2
  18. data/db/migrate/20191201134420_create_ecom_core_work_component_templates.rb +8 -6
  19. data/db/migrate/20191201145848_create_ecom_core_projects.rb +28 -13
  20. data/db/migrate/20191202103735_create_ecom_core_tasks.rb +8 -5
  21. data/db/migrate/20191202105355_create_task_templates_resource_types.rb +8 -7
  22. data/db/migrate/20191202220832_create_ecom_core_users.rb +9 -6
  23. data/db/migrate/20191202220953_create_ecom_core_user_roles.rb +13 -8
  24. data/db/migrate/20191202221423_create_ecom_core_menus.rb +16 -9
  25. data/db/migrate/20191202235434_create_ecom_core_work_products.rb +29 -15
  26. data/db/migrate/20191206104247_create_ecom_core_work_components.rb +24 -14
  27. data/db/migrate/20191225100054_create_ecom_core_crews.rb +5 -3
  28. data/db/migrate/20191225121850_create_ecom_core_project_crews.rb +19 -0
  29. data/db/migrate/{20200401040433_create_ecom_core_attendance_sheets.rb → 20191225140433_create_ecom_core_attendance_sheets.rb} +4 -0
  30. data/db/migrate/20191225162539_create_ecom_core_attendance_sheet_entries.rb +17 -0
  31. data/db/migrate/20191225211712_create_ecom_core_crew_times.rb +15 -9
  32. data/db/migrate/20200126081005_create_ecom_core_payrolls.rb +4 -0
  33. data/db/migrate/20200126082103_create_ecom_core_payments.rb +6 -3
  34. data/db/migrate/20200126183218_create_ecom_core_payment_details.rb +10 -5
  35. data/db/migrate/20200307112519_create_ecom_core_custom_payment_details.rb +4 -3
  36. data/db/migrate/20200315145215_create_ecom_core_equipment_locations.rb +4 -3
  37. data/db/migrate/20200315150500_create_ecom_core_equipment_categories.rb +4 -2
  38. data/db/migrate/20200315152143_create_ecom_core_equipment.rb +4 -2
  39. data/db/migrate/20200315153640_create_ecom_core_equipment_items.rb +8 -5
  40. data/db/migrate/20200315160810_create_ecom_core_equipment_valuations.rb +4 -3
  41. data/db/migrate/20200316125323_create_ecom_core_equipment_components.rb +4 -3
  42. data/db/migrate/20200410090701_create_ecom_core_overtime_sheets.rb +4 -0
  43. data/db/migrate/20200410100035_create_ecom_core_overtime_sheet_entries.rb +8 -5
  44. data/db/migrate/20200410111827_create_ecom_core_crew_overtimes.rb +17 -11
  45. data/lib/ecom/core/version.rb +1 -1
  46. data/spec/factories/ecom/core/application_modules.rb +1 -1
  47. data/spec/factories/ecom/core/attendance_sheet_entries.rb +1 -1
  48. data/spec/factories/ecom/core/attendance_sheets.rb +2 -1
  49. data/spec/factories/ecom/core/companies.rb +9 -0
  50. data/spec/factories/ecom/core/crew_overtimes.rb +1 -1
  51. data/spec/factories/ecom/core/crew_times.rb +1 -1
  52. data/spec/factories/ecom/core/crew_types.rb +1 -1
  53. data/spec/factories/ecom/core/crews.rb +1 -1
  54. data/spec/factories/ecom/core/currencies.rb +1 -1
  55. data/spec/factories/ecom/core/custom_payment_details.rb +1 -1
  56. data/spec/factories/ecom/core/equipment.rb +1 -1
  57. data/spec/factories/ecom/core/equipment_categories.rb +1 -1
  58. data/spec/factories/ecom/core/equipment_components.rb +1 -1
  59. data/spec/factories/ecom/core/equipment_items.rb +1 -1
  60. data/spec/factories/ecom/core/equipment_locations.rb +1 -1
  61. data/spec/factories/ecom/core/equipment_types.rb +1 -1
  62. data/spec/factories/ecom/core/equipment_valuations.rb +1 -1
  63. data/spec/factories/ecom/core/location_types.rb +1 -1
  64. data/spec/factories/ecom/core/lookups.rb +1 -1
  65. data/spec/factories/ecom/core/material_types.rb +1 -1
  66. data/spec/factories/ecom/core/menus.rb +1 -1
  67. data/spec/factories/ecom/core/overtime_sheet_entries.rb +1 -1
  68. data/spec/factories/ecom/core/overtime_sheets.rb +2 -1
  69. data/spec/factories/ecom/core/overtime_types.rb +1 -1
  70. data/spec/factories/ecom/core/payment_details.rb +1 -1
  71. data/spec/factories/ecom/core/payments.rb +1 -1
  72. data/spec/factories/ecom/core/payrolls.rb +2 -1
  73. data/spec/factories/ecom/core/product_types.rb +1 -1
  74. data/spec/factories/ecom/core/project_crews.rb +9 -0
  75. data/spec/factories/ecom/core/projects.rb +2 -1
  76. data/spec/factories/ecom/core/resource_types.rb +1 -1
  77. data/spec/factories/ecom/core/stakeholder_types.rb +1 -1
  78. data/spec/factories/ecom/core/stakeholders.rb +1 -1
  79. data/spec/factories/ecom/core/task_template_types.rb +1 -1
  80. data/spec/factories/ecom/core/task_templates.rb +1 -1
  81. data/spec/factories/ecom/core/tasks.rb +1 -1
  82. data/spec/factories/ecom/core/user_roles.rb +1 -1
  83. data/spec/factories/ecom/core/users.rb +1 -1
  84. data/spec/factories/ecom/core/work_component_templates.rb +1 -1
  85. data/spec/factories/ecom/core/work_components.rb +1 -1
  86. data/spec/factories/ecom/core/work_product_templates.rb +1 -1
  87. data/spec/factories/ecom/core/work_products.rb +2 -2
  88. metadata +25 -15
  89. data/db/migrate/20200207035823_add_additional_columns_to_payment.rb +0 -6
  90. data/db/migrate/20200207040844_add_net_pay_column_to_payment_details.rb +0 -5
  91. data/db/migrate/20200210095535_add_advance_column_to_payment_details.rb +0 -5
  92. data/db/migrate/20200221123207_add_employee_id_to_crew.rb +0 -5
  93. data/db/migrate/20200401071343_remove_date_column_from_crew_times.rb +0 -5
  94. data/db/migrate/20200401122539_create_ecom_core_attendance_sheet_entries.rb +0 -14
  95. data/db/migrate/20200401142959_relate_crew_time_with_attendance_sheet_entry.rb +0 -8
  96. data/db/migrate/20200401144137_remove_crew_time_id_from_crew.rb +0 -7
  97. data/db/migrate/20200413144023_fix_crew_time_columns.rb +0 -17
  98. data/db/migrate/20200414044144_adjust_crew_overtime_column_names.rb +0 -6
  99. data/db/migrate/20200414185248_change_time_columns_to_datetime.rb +0 -8
@@ -7,24 +7,34 @@ class CreateEcomCoreWorkComponents < ActiveRecord::Migration[6.0]
7
7
  t.string :task_status, null: false, default: :new
8
8
  t.integer :percent_completed, null: false, default: 0
9
9
  t.string :remark
10
- t.references :performer, index: { name: 'wc_on_performer_indx' }
11
- t.references :approver, index: { name: 'wc_on_approver_indx' }
12
- t.references :supervisor, index: { name: 'wc_on_supervisor_indx' }
13
- t.references :quality_controller, index: { name: 'wc_on_qc_indx' }
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 }
14
26
  t.date :start_date
15
27
  t.date :completion_date
16
- t.references :work_component_template, index: { name: 'wct_on_wc_indx' }
17
- t.references :work_product, index: { name: 'wp_on_wc_indx' }
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 }
18
36
 
19
37
  t.timestamps
20
38
  end
21
-
22
- add_foreign_key :ecom_core_work_components, :ecom_core_users, column: :performer_id
23
- add_foreign_key :ecom_core_work_components, :ecom_core_users, column: :approver_id
24
- add_foreign_key :ecom_core_work_components, :ecom_core_users, column: :supervisor_id
25
- add_foreign_key :ecom_core_work_components, :ecom_core_users, column: :quality_controller_id
26
- add_foreign_key :ecom_core_work_components, :ecom_core_work_component_templates,
27
- column: :work_component_template_id
28
- add_foreign_key :ecom_core_work_components, :ecom_core_work_products, column: :work_product_id
29
39
  end
30
40
  end
@@ -1,6 +1,7 @@
1
1
  class CreateEcomCoreCrews < ActiveRecord::Migration[6.0]
2
2
  def change
3
3
  create_table :ecom_core_crews do |t|
4
+ t.string :employee_id
4
5
  t.string :name, null: false
5
6
  t.string :phone
6
7
  t.string :email
@@ -12,11 +13,12 @@ class CreateEcomCoreCrews < ActiveRecord::Migration[6.0]
12
13
  t.string :guarantor_name
13
14
  t.string :guarantor_phone
14
15
  t.boolean :active, null: false, default: true
15
- t.references :crew_type, index: { name: 'crew_on_ct_indx' }
16
+ t.references :crew_type,
17
+ null: false,
18
+ index: { name: 'crew_on_ct_indx' },
19
+ foreign_key: { to_table: :ecom_core_resource_types }
16
20
 
17
21
  t.timestamps
18
22
  end
19
-
20
- add_foreign_key :ecom_core_crews, :ecom_core_resource_types, column: :crew_type_id
21
23
  end
22
24
  end
@@ -0,0 +1,19 @@
1
+ class CreateEcomCoreProjectCrews < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :ecom_core_project_crews do |t|
4
+ t.references :project,
5
+ null: false,
6
+ index: { name: 'pc_on_project_indx' },
7
+ foreign_key: { to_table: :ecom_core_projects }
8
+ t.references :crew,
9
+ null: false,
10
+ index: { name: 'pc_on_crew_indx' },
11
+ foreign_key: { to_table: :ecom_core_crews }
12
+ t.date :start_date, null: false
13
+ t.date :end_date
14
+ t.string :status, null: false, default: 'Inactive'
15
+
16
+ t.timestamps
17
+ end
18
+ end
19
+ end
@@ -6,6 +6,10 @@ class CreateEcomCoreAttendanceSheets < ActiveRecord::Migration[6.0]
6
6
  t.time :closed_at
7
7
  t.string :remark
8
8
  t.string :status, null: false, default: 'Open'
9
+ t.references :project,
10
+ null: false,
11
+ index: { name: 'as_on_project_indx' },
12
+ foreign_key: { to_table: :ecom_core_projects }
9
13
 
10
14
  t.timestamps
11
15
  end
@@ -0,0 +1,17 @@
1
+ class CreateEcomCoreAttendanceSheetEntries < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :ecom_core_attendance_sheet_entries do |t|
4
+ t.references :attendance_sheet,
5
+ null: false,
6
+ index: { name: 'ase_on_as_indx' },
7
+ foreign_key: { to_table: :ecom_core_attendance_sheets }
8
+ t.references :crew,
9
+ null: false,
10
+ index: { name: 'ase_on_crew_indx' },
11
+ foreign_key: { to_table: :ecom_core_crews }
12
+ t.float :total_hours
13
+
14
+ t.timestamps
15
+ end
16
+ end
17
+ end
@@ -1,19 +1,25 @@
1
1
  class CreateEcomCoreCrewTimes < ActiveRecord::Migration[6.0]
2
2
  def change
3
3
  create_table :ecom_core_crew_times do |t|
4
- t.date :date, null: false
5
- t.time :checkin_time
6
- t.time :checkout_time
4
+ t.datetime :checkin_time
5
+ t.datetime :checkout_time
7
6
  t.float :hours, null: false
8
- t.float :converted_hours, null: false, default: 0
9
- t.references :crew, index: { name: 'ct_on_crew_indx' }
10
7
  t.string :remark
11
- t.boolean :overtime, null: false, default: false
12
- t.integer :overtime_type_id, null: true
8
+ t.boolean :revised, null: false, default: false
9
+ t.references :revision_to,
10
+ null: true,
11
+ index: { name: 'ct_on_rt_indx' },
12
+ foreign_key: { to_table: :ecom_core_crew_times }
13
+ t.references :created_by,
14
+ null: false,
15
+ index: { name: 'ct_on_cb_indx' },
16
+ foreign_key: { to_table: :ecom_core_users }
17
+ t.references :attendance_sheet_entry,
18
+ null: false,
19
+ index: { name: 'ct_on_ase_indx' },
20
+ foreign_key: { to_table: :ecom_core_attendance_sheet_entries }
13
21
 
14
22
  t.timestamps
15
23
  end
16
-
17
- add_foreign_key :ecom_core_crew_times, :ecom_core_crews, column: :crew_id
18
24
  end
19
25
  end
@@ -4,6 +4,10 @@ class CreateEcomCorePayrolls < ActiveRecord::Migration[6.0]
4
4
  t.integer :month, null: false
5
5
  t.integer :year, null: false
6
6
  t.boolean :approved, null: false, default: false
7
+ t.references :project,
8
+ null: false,
9
+ index: { name: 'payroll_on_project_indx' },
10
+ foreign_key: { to_table: :ecom_core_projects }
7
11
 
8
12
  t.timestamps
9
13
  end
@@ -3,11 +3,14 @@ class CreateEcomCorePayments < ActiveRecord::Migration[6.0]
3
3
  create_table :ecom_core_payments do |t|
4
4
  t.date :from, null: false
5
5
  t.date :to, null: false
6
- t.references :payroll, null: false, index: { name: 'payments_on_payroll_indx' }
6
+ t.boolean :approved, null: false, default: false
7
+ t.integer :payment_order, null: false, default: 1
8
+ t.references :payroll,
9
+ null: false,
10
+ index: { name: 'payments_on_payroll_indx' },
11
+ foreign_key: { to_table: :ecom_core_payrolls }
7
12
 
8
13
  t.timestamps
9
14
  end
10
-
11
- add_foreign_key :ecom_core_payments, :ecom_core_payrolls, column: :payroll_id
12
15
  end
13
16
  end
@@ -9,13 +9,18 @@ class CreateEcomCorePaymentDetails < ActiveRecord::Migration[6.0]
9
9
  t.float :tax, null: false, default: 0
10
10
  t.float :pension, null: false, default: 0
11
11
  t.float :net_salary, null: false
12
- t.references :crew, null: false, index: { name: 'pd_on_crew_indx' }
13
- t.references :payment, null: false, index: { name: 'pd_on_payment_indx' }
12
+ t.float :advance, null: false, default: 0
13
+ t.float :net_pay, null: false, default: 0
14
+ t.references :crew,
15
+ null: false,
16
+ index: { name: 'pd_on_crew_indx' },
17
+ foreign_key: { to_table: :ecom_core_crews }
18
+ t.references :payment,
19
+ null: false,
20
+ index: { name: 'pd_on_payment_indx' },
21
+ foreign_key: { to_table: :ecom_core_payments }
14
22
 
15
23
  t.timestamps
16
24
  end
17
-
18
- add_foreign_key :ecom_core_payment_details, :ecom_core_crews, column: :crew_id
19
- add_foreign_key :ecom_core_payment_details, :ecom_core_payments, column: :payment_id
20
25
  end
21
26
  end
@@ -14,11 +14,12 @@ class CreateEcomCoreCustomPaymentDetails < ActiveRecord::Migration[6.0]
14
14
  t.float :advance, null: false
15
15
  t.float :wage, null: false
16
16
  t.string :qualification
17
- t.references :payment, null: false, index: { name: 'cpd_on_payment_indx' }
17
+ t.references :payment,
18
+ null: false,
19
+ index: { name: 'cpd_on_payment_indx' },
20
+ foreign_key: { to_table: :ecom_core_payments }
18
21
 
19
22
  t.timestamps
20
23
  end
21
-
22
- add_foreign_key :ecom_core_custom_payment_details, :ecom_core_payments, column: :payment_id
23
24
  end
24
25
  end
@@ -4,11 +4,12 @@ class CreateEcomCoreEquipmentLocations < ActiveRecord::Migration[6.0]
4
4
  t.string :name, null: false, unique: true
5
5
  t.string :description
6
6
  t.string :address, null: false
7
- t.references :location_type, null: false, index: { name: 'ecel_on_lt_indx' }
7
+ t.references :location_type,
8
+ null: false,
9
+ index: { name: 'ecel_on_lt_indx' },
10
+ foreign_key: { to_table: :ecom_core_lookups }
8
11
 
9
12
  t.timestamps
10
13
  end
11
-
12
- add_foreign_key :ecom_core_equipment_locations, :ecom_core_lookups, column: :location_type_id
13
14
  end
14
15
  end
@@ -3,12 +3,14 @@ class CreateEcomCoreEquipmentCategories < ActiveRecord::Migration[6.0]
3
3
  create_table :ecom_core_equipment_categories do |t|
4
4
  t.string :name, null: false
5
5
  t.string :description
6
- t.references :equipment_type, null: false, index: { name: 'et_on_ecec_indx' }
6
+ t.references :equipment_type,
7
+ null: false,
8
+ index: { name: 'et_on_ecec_indx' },
9
+ foreign_key: { to_table: :ecom_core_resource_types }
7
10
 
8
11
  t.timestamps
9
12
  end
10
13
 
11
14
  add_index :ecom_core_equipment_categories, %i[name equipment_type_id], unique: true, name: 'ecec_name_et_indx'
12
- add_foreign_key :ecom_core_equipment_categories, :ecom_core_resource_types, column: :equipment_type_id
13
15
  end
14
16
  end
@@ -4,12 +4,14 @@ class CreateEcomCoreEquipment < ActiveRecord::Migration[6.0]
4
4
  t.string :name, null: false
5
5
  t.string :description
6
6
  t.float :minimum_acquisition_time, null: false, default: 0
7
- t.references :equipment_category, null: false, index: { name: 'ec_on_ece_indx' }
7
+ t.references :equipment_category,
8
+ null: false,
9
+ index: { name: 'ec_on_ece_indx' },
10
+ foreign_key: { to_table: :ecom_core_equipment_categories }
8
11
 
9
12
  t.timestamps
10
13
  end
11
14
 
12
15
  add_index :ecom_core_equipment, %i[name equipment_category_id], unique: true
13
- add_foreign_key :ecom_core_equipment, :ecom_core_equipment_categories, column: :equipment_category_id
14
16
  end
15
17
  end
@@ -11,13 +11,16 @@ class CreateEcomCoreEquipmentItems < ActiveRecord::Migration[6.0]
11
11
  t.date :purchase_date, null: false
12
12
  t.float :license_fee
13
13
  t.float :tax
14
- t.references :equipment, null: false, index: { name: 'equipment_on_ei_indx' }
15
- t.references :current_location, null: false, index: { name: 'equipment_on_el_indx' }
14
+ t.references :equipment,
15
+ null: false,
16
+ index: { name: 'equipment_on_ei_indx' },
17
+ foreign_key: { to_table: :ecom_core_equipment }
18
+ t.references :current_location,
19
+ null: false,
20
+ index: { name: 'equipment_on_el_indx' },
21
+ foreign_key: { to_table: :ecom_core_equipment_locations }
16
22
 
17
23
  t.timestamps
18
24
  end
19
-
20
- add_foreign_key :ecom_core_equipment_items, :ecom_core_equipment, column: :equipment_id
21
- add_foreign_key :ecom_core_equipment_items, :ecom_core_equipment_locations, column: :current_location_id
22
25
  end
23
26
  end
@@ -11,11 +11,12 @@ class CreateEcomCoreEquipmentValuations < ActiveRecord::Migration[6.0]
11
11
  t.float :repair_rate
12
12
  t.float :rate_of_return
13
13
  t.boolean :current, null: false, default: true
14
- t.references :equipment_item, index: { name: 'ev_on_ei_indx' }
14
+ t.references :equipment_item,
15
+ null: false,
16
+ index: { name: 'ev_on_ei_indx' },
17
+ foreign_key: { to_table: :ecom_core_equipment_items }
15
18
 
16
19
  t.timestamps
17
20
  end
18
-
19
- add_foreign_key :ecom_core_equipment_valuations, :ecom_core_equipment_items, column: :equipment_item_id
20
21
  end
21
22
  end
@@ -3,11 +3,12 @@ class CreateEcomCoreEquipmentComponents < ActiveRecord::Migration[6.0]
3
3
  create_table :ecom_core_equipment_components do |t|
4
4
  t.string :serial_number
5
5
  t.string :name, null: false
6
- t.references :equipment_item, null: false, index: { name: 'ei_on_ec_indx' }
6
+ t.references :equipment_item,
7
+ null: false,
8
+ index: { name: 'ei_on_ec_indx' },
9
+ foreign_key: { to_table: :ecom_core_equipment_items }
7
10
 
8
11
  t.timestamps
9
12
  end
10
-
11
- add_foreign_key :ecom_core_equipment_components, :ecom_core_equipment_items, column: :equipment_item_id
12
13
  end
13
14
  end
@@ -5,6 +5,10 @@ class CreateEcomCoreOvertimeSheets < ActiveRecord::Migration[6.0]
5
5
  t.time :opened_at, null: false
6
6
  t.time :submitted_at
7
7
  t.string :status, null: false, default: 'Open'
8
+ t.references :project,
9
+ null: false,
10
+ index: { name: 'os_on_project_indx' },
11
+ foreign_key: { to_table: :ecom_core_projects }
8
12
 
9
13
  t.timestamps
10
14
  end
@@ -1,14 +1,17 @@
1
1
  class CreateEcomCoreOvertimeSheetEntries < ActiveRecord::Migration[6.0]
2
2
  def change
3
3
  create_table :ecom_core_overtime_sheet_entries do |t|
4
- t.references :overtime_sheet, null: false, index: { name: 'ose_on_os_indx' }
5
- t.references :crew, null: false, index: { name: 'ose_on_crew_indx' }
4
+ t.references :overtime_sheet,
5
+ null: false,
6
+ index: { name: 'ose_on_os_indx' },
7
+ foreign_key: { to_table: :ecom_core_overtime_sheets }
8
+ t.references :crew,
9
+ null: false,
10
+ index: { name: 'ose_on_crew_indx' },
11
+ foreign_key: { to_table: :ecom_core_crews }
6
12
  t.float :total_overtime
7
13
 
8
14
  t.timestamps
9
15
  end
10
- add_foreign_key :ecom_core_overtime_sheet_entries, :ecom_core_overtime_sheets,
11
- column: :overtime_sheet_id
12
- add_foreign_key :ecom_core_overtime_sheet_entries, :ecom_core_crews, column: :crew_id
13
16
  end
14
17
  end
@@ -1,21 +1,27 @@
1
1
  class CreateEcomCoreCrewOvertimes < ActiveRecord::Migration[6.0]
2
2
  def change
3
3
  create_table :ecom_core_crew_overtimes do |t|
4
- t.float :hours, null: false
5
- t.float :converted_hours, null: false, default: 0
4
+ t.float :raw_hours, null: false
5
+ t.float :hours, null: false, default: 0
6
6
  t.string :remark
7
- t.references :overtime_type, null: false, index: { name: 'ot_on_co_indx' }
8
- t.references :overtime_sheet_entry, null: false, index: { name: 'ose_on_co_indx' }
7
+ t.references :overtime_type,
8
+ null: false,
9
+ index: { name: 'ot_on_co_indx' },
10
+ foreign_key: { to_table: :ecom_core_overtime_types }
11
+ t.references :overtime_sheet_entry,
12
+ null: false,
13
+ index: { name: 'ose_on_co_indx' },
14
+ foreign_key: { to_table: :ecom_core_overtime_sheet_entries }
9
15
  t.boolean :revised, null: false, default: false
10
- t.references :revision_to, null: true
11
- t.references :created_by, null: false, index: { name: 'cb_on_co_indx' }
16
+ t.references :revision_to,
17
+ null: true,
18
+ foreign_key: { to_table: :ecom_core_crew_overtimes }
19
+ t.references :created_by,
20
+ null: false,
21
+ index: { name: 'cb_on_co_indx' },
22
+ foreign_key: { to_table: :ecom_core_users }
12
23
 
13
24
  t.timestamps
14
25
  end
15
- add_foreign_key :ecom_core_crew_overtimes, :ecom_core_overtime_types, column: :overtime_type_id
16
- add_foreign_key :ecom_core_crew_overtimes, :ecom_core_overtime_sheet_entries,
17
- column: :overtime_sheet_entry_id
18
- add_foreign_key :ecom_core_crew_overtimes, :ecom_core_crew_overtimes, column: :revision_to_id
19
- add_foreign_key :ecom_core_crew_overtimes, :ecom_core_users, column: :created_by_id
20
26
  end
21
27
  end
@@ -1,5 +1,5 @@
1
1
  module Ecom
2
2
  module Core
3
- VERSION = '1.2.5'.freeze
3
+ VERSION = '1.2.6'.freeze
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :application_module, class: 'Ecom::Core::ApplicationModule' do
2
+ factory :application_module, class: Ecom::Core::ApplicationModule do
3
3
  code { FFaker::Name.name }
4
4
  name { FFaker::Name.name }
5
5
  end
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :attendance_sheet_entry, class: 'Ecom::Core::AttendanceSheetEntry' do
2
+ factory :attendance_sheet_entry, class: Ecom::Core::AttendanceSheetEntry do
3
3
  association :attendance_sheet
4
4
  association :crew
5
5
  total_hours { FFaker::Random.rand(0..8) }
@@ -1,9 +1,10 @@
1
1
  FactoryBot.define do
2
- factory :attendance_sheet, class: 'Ecom::Core::AttendanceSheet' do
2
+ factory :attendance_sheet, class: Ecom::Core::AttendanceSheet do
3
3
  date { Date.today }
4
4
  opened_at { Time.now }
5
5
  closed_at { nil }
6
6
  remark { FFaker::Name.name }
7
7
  status { Ecom::Core::AttendanceSheet::OPEN }
8
+ association :project
8
9
  end
9
10
  end
@@ -0,0 +1,9 @@
1
+ FactoryBot.define do
2
+ factory :company, class: Ecom::Core::Company do
3
+ code { FFaker::Name.name }
4
+ name { FFaker::Name.name }
5
+ address { FFaker::Address.street_address }
6
+ telephone { FFaker::PhoneNumber.phone_number }
7
+ email { FFaker::Internet.email }
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :crew_overtime, class: 'Ecom::Core::CrewOvertime' do
2
+ factory :crew_overtime, class: Ecom::Core::CrewOvertime do
3
3
  raw_hours { 2 }
4
4
  hours { 2 }
5
5
  remark { FFaker::Name.name }
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :crew_time, class: 'Ecom::Core::CrewTime' do
2
+ factory :crew_time, class: Ecom::Core::CrewTime do
3
3
  checkin_time { Time.now }
4
4
  checkout_time { Time.now + 2 * 60 * 60 }
5
5
  hours { 2 }
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :crew_type, class: 'Ecom::Core::CrewType', parent: :resource_type do
2
+ factory :crew_type, class: Ecom::Core::CrewType, parent: :resource_type do
3
3
  type { 'Ecom::Core::CrewType' }
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :crew, class: 'Ecom::Core::Crew' do
2
+ factory :crew, class: Ecom::Core::Crew do
3
3
  name { FFaker::Name.name }
4
4
  phone { FFaker::Name.name }
5
5
  email { FFaker::Name.name }
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :currency, class: 'Ecom::Core::Currency' do
2
+ factory :currency, class: Ecom::Core::Currency do
3
3
  code { FFaker::Currency.code }
4
4
  name { FFaker::Currency.name }
5
5
  end
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :custom_payment_detail, class: 'Ecom::Core::CustomPaymentDetail' do
2
+ factory :custom_payment_detail, class: Ecom::Core::CustomPaymentDetail do
3
3
  name { FFaker::Name.name }
4
4
  hours { 1.5 }
5
5
  ot_hours { 1.5 }
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :equipment, class: 'Ecom::Core::Equipment' do
2
+ factory :equipment, class: Ecom::Core::Equipment do
3
3
  name { FFaker::Name.name }
4
4
  description { FFaker::Name.name }
5
5
  minimum_acquisition_time { 10 }
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :equipment_category, class: 'Ecom::Core::EquipmentCategory' do
2
+ factory :equipment_category, class: Ecom::Core::EquipmentCategory do
3
3
  name { FFaker::Name.name }
4
4
  description { FFaker::Name.name }
5
5
  association :equipment_type
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :equipment_component, class: 'Ecom::Core::EquipmentComponent' do
2
+ factory :equipment_component, class: Ecom::Core::EquipmentComponent do
3
3
  serial_number { FFaker::Name.name }
4
4
  name { FFaker::Name.name }
5
5
  association :equipment_item
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :equipment_item, class: 'Ecom::Core::EquipmentItem' do
2
+ factory :equipment_item, class: Ecom::Core::EquipmentItem do
3
3
  name { FFaker::Name.name }
4
4
  description { FFaker::Name.name }
5
5
  status { FFaker::Name.name }
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :equipment_location, class: 'Ecom::Core::EquipmentLocation' do
2
+ factory :equipment_location, class: Ecom::Core::EquipmentLocation do
3
3
  name { FFaker::Name.name }
4
4
  description { FFaker::Name.name }
5
5
  address { FFaker::Name.name }
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :equipment_type, class: 'Ecom::Core::EquipmentType', parent: :resource_type do
2
+ factory :equipment_type, class: Ecom::Core::EquipmentType, parent: :resource_type do
3
3
  type { 'Ecom::Core::EquipmentType' }
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :equipment_valuation, class: 'Ecom::Core::EquipmentValuation' do
2
+ factory :equipment_valuation, class: Ecom::Core::EquipmentValuation do
3
3
  equipment_value { 1500 }
4
4
  residual_value { 150 }
5
5
  work_hrs_per_yr { 150 }
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :location_type, class: 'Ecom::Core::LocationType', parent: :lookup do
2
+ factory :location_type, class: Ecom::Core::LocationType, parent: :lookup do
3
3
  type { 'Ecom::Core::LocationType' }
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :lookup, class: 'Ecom::Core::Lookup' do
2
+ factory :lookup, class: Ecom::Core::Lookup do
3
3
  name { FFaker::Name.name }
4
4
  type { 'Ecom::Core::Lookup' }
5
5
  end
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :material_type, class: 'Ecom::Core::MaterialType', parent: :resource_type do
2
+ factory :material_type, class: Ecom::Core::MaterialType, parent: :resource_type do
3
3
  type { 'Ecom::Core::MaterialType' }
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :menu, class: 'Ecom::Core::Menu' do
2
+ factory :menu, class: Ecom::Core::Menu do
3
3
  label { FFaker::Name.name }
4
4
  icon { FFaker::Name.name }
5
5
  route { FFaker::Name.name }
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :overtime_sheet_entry, class: 'Ecom::Core::OvertimeSheetEntry' do
2
+ factory :overtime_sheet_entry, class: Ecom::Core::OvertimeSheetEntry do
3
3
  association :overtime_sheet
4
4
  association :crew
5
5
  total_overtime { FFaker::Random.rand(0..8) }
@@ -1,8 +1,9 @@
1
1
  FactoryBot.define do
2
- factory :overtime_sheet, class: 'Ecom::Core::OvertimeSheet' do
2
+ factory :overtime_sheet, class: Ecom::Core::OvertimeSheet do
3
3
  date { Date.today }
4
4
  opened_at { Time.now }
5
5
  submitted_at { Time.now + 1.day }
6
6
  status { Ecom::Core::OvertimeSheet::OPEN }
7
+ association :project
7
8
  end
8
9
  end
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :overtime_type, class: 'Ecom::Core::OvertimeType' do
2
+ factory :overtime_type, class: Ecom::Core::OvertimeType do
3
3
  name { FFaker::Name.name }
4
4
  from { '07:00 AM' }
5
5
  to { '08:00 AM' }
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :payment_detail, class: 'Ecom::Core::PaymentDetail' do
2
+ factory :payment_detail, class: Ecom::Core::PaymentDetail do
3
3
  hours { 1.5 }
4
4
  ot_hours { 1.5 }
5
5
  base_salary { 1.5 }