ecom_core 1.0.8 → 1.0.9
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b59b8dbf20e8f81cb6c76f89b92f1b0b120a9b487846039b5c2b476d177ea8a
|
4
|
+
data.tar.gz: c254bb1490b4512d45f6add059f3e7a8685ccd571dca843e46e8a57c9c17b9fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fadd3b668c06009686cdbadf0b13933d7dba415ca4e825fbb68889d380ce2803832494583bec9ccc4ac1bea28f6df79ac1da211482cc9a9b88c3fa7c1f719f5
|
7
|
+
data.tar.gz: ec05075973f8df540d177cb9ea188f2f68bdc7aa11250ffb164fc3bb3d9ac039df055a7251a52a54fda1c36166220ed1d3759a31e912a87bce256aaf986f4284
|
@@ -4,7 +4,18 @@ module Ecom
|
|
4
4
|
belongs_to :crew
|
5
5
|
belongs_to :overtime_type, optional: true
|
6
6
|
|
7
|
-
validates :date, :hours, presence: true
|
7
|
+
validates :date, :hours, :converted_hours, presence: true
|
8
|
+
|
9
|
+
before_save :calculate_converted_hours
|
10
|
+
|
11
|
+
def calculate_converted_hours
|
12
|
+
if overtime
|
13
|
+
rate = OvertimeType.find(overtime_type_id).rate
|
14
|
+
self.converted_hours = hours * rate
|
15
|
+
else
|
16
|
+
self.converted_hours = hours
|
17
|
+
end
|
18
|
+
end
|
8
19
|
end
|
9
20
|
end
|
10
21
|
end
|
@@ -5,10 +5,11 @@ class CreateEcomCoreCrewTimes < ActiveRecord::Migration[6.0]
|
|
5
5
|
t.time :checkin_time
|
6
6
|
t.time :checkout_time
|
7
7
|
t.float :hours, null: false
|
8
|
+
t.float :converted_hours, null: false
|
8
9
|
t.references :crew, index: { name: 'ct_on_crew_indx' }
|
9
10
|
t.string :remark
|
10
11
|
t.boolean :overtime, null: false, default: false
|
11
|
-
t.
|
12
|
+
t.integer :overtime_type_id, null: true
|
12
13
|
|
13
14
|
t.timestamps
|
14
15
|
end
|
data/lib/ecom/core/version.rb
CHANGED