ecom_core 1.1.28 → 1.2.0
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.rb +1 -1
- data/app/models/ecom/core/crew_time.rb +9 -6
- data/lib/ecom/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c880918c195007a5c24b11ac57b0160a2cb0f4004b14b859c393865537e484a
|
4
|
+
data.tar.gz: 5cd617cb086e5eced01b34ee17744562ebd09a6b292cd87b04539fd991c23a8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dce9a7cad7872a933db194376bf18f827b250db066125b4806e17078136263e9870cb1cac44f9569304317cfcd615de4f75c7cae642c5df1cfa664f013f2cc5
|
7
|
+
data.tar.gz: feec5c565c568e36611345e6c672dd5c730f236ee1b4d732856c072e6e1afb7b6bdd7d4ac8776608298348c74e1b41a126eb7300020a92b4db01e70af4c6d9e4
|
@@ -5,7 +5,7 @@ module Ecom
|
|
5
5
|
SUBMITTED = 'Submitted'.freeze
|
6
6
|
APPROVED = 'Approved'.freeze
|
7
7
|
|
8
|
-
validates :date,
|
8
|
+
validates :date, presence: true, uniqueness: true
|
9
9
|
validates :status, inclusion: [OPEN, SUBMITTED, APPROVED]
|
10
10
|
|
11
11
|
has_many :attendance_sheet_entries
|
@@ -27,10 +27,10 @@ module Ecom
|
|
27
27
|
|
28
28
|
# A method to check if checkin and checkout range falls in the morning,
|
29
29
|
# afternoon, or both.
|
30
|
-
def find_range
|
31
|
-
if
|
30
|
+
def find_range(start, finish)
|
31
|
+
if start.before?(TIME_RANGE[MORNING][:end]) && finish.before?(TIME_RANGE[AFTERNOON][:start])
|
32
32
|
MORNING
|
33
|
-
elsif
|
33
|
+
elsif start.after?(TIME_RANGE[MORNING][:end]) && finish.after?(TIME_RANGE[AFTERNOON][:start])
|
34
34
|
AFTERNOON
|
35
35
|
else
|
36
36
|
BOTH
|
@@ -40,9 +40,12 @@ module Ecom
|
|
40
40
|
# A method to adjust time ranges by trimming any time value outside
|
41
41
|
# of the defined morning and afternoon ranges
|
42
42
|
def compute_hours
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
# Reparse time to avoid errors caused by date differences
|
44
|
+
start = Time.zone.parse(checkin_time.strftime('%I:%M%p'))
|
45
|
+
finish = Time.zone.parse(checkout_time.strftime('%I:%M%p'))
|
46
|
+
range = find_range(start, finish)
|
47
|
+
left = start.before?(TIME_RANGE[range][:start]) ? TIME_RANGE[range][:start] : start
|
48
|
+
right = finish.after?(TIME_RANGE[range][:end]) ? TIME_RANGE[range][:end] : finish
|
46
49
|
time = (right - left) / 1.hour
|
47
50
|
time -= 1 if range == BOTH
|
48
51
|
time
|
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.
|
4
|
+
version: 1.2.0
|
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-04-
|
11
|
+
date: 2020-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aasm
|