ecom_core 1.1.14 → 1.1.15
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/attendance_sheet.rb +13 -12
- 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: d9fc9fe1236a00b622bd5943fab08346f23c4de7f059e65fddb511907eda18bf
|
4
|
+
data.tar.gz: cf6f34036919d900666afcd8419b26ca5f6e9b2ec45f047e4e3afb3bba27c649
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f2d852b30af828fd6dbdfe72a0663905285f98c1b935becd9953fd54433502cc7fdea620e8f43cf11719d723aa8cfcb8622cd74937404658c39ee9229fd1909
|
7
|
+
data.tar.gz: fc8f98d4b4c383a13092c5166963163afcde41745d279f8a97fa025ee66c3e19de0d906855e970b444879b147972b00a0f59efa01f3166f6fde1714ec1c58620
|
@@ -2,10 +2,11 @@ module Ecom
|
|
2
2
|
module Core
|
3
3
|
class AttendanceSheet < ApplicationRecord
|
4
4
|
OPEN = 'Open'.freeze
|
5
|
-
|
5
|
+
SUBMITTED = 'Submitted'.freeze
|
6
|
+
APPROVED = 'Approved'.freeze
|
6
7
|
|
7
8
|
validates :date, :opened_at, presence: true, uniqueness: true
|
8
|
-
validates :status, inclusion: [OPEN,
|
9
|
+
validates :status, inclusion: [OPEN, SUBMITTED, APPROVED]
|
9
10
|
|
10
11
|
has_many :attendance_sheet_entries
|
11
12
|
|
@@ -31,28 +32,28 @@ module Ecom
|
|
31
32
|
AttendanceSheet.create(date: Date.today, opened_at: Time.now, status: OPEN)
|
32
33
|
end
|
33
34
|
|
34
|
-
def self.
|
35
|
+
def self.submit_current
|
35
36
|
sheet = AttendanceSheet.find_by(date: Date.today, status: OPEN)
|
36
37
|
|
37
|
-
raise 'There is no attendance sheet to
|
38
|
+
raise 'There is no open attendance sheet to submit.' if sheet.nil?
|
38
39
|
|
39
40
|
sheet.closed_at = Time.now
|
40
|
-
sheet.status =
|
41
|
+
sheet.status = SUBMITTED
|
41
42
|
sheet.save
|
42
43
|
sheet
|
43
44
|
end
|
44
45
|
|
45
46
|
# This method should be used by privileged users
|
46
|
-
# to
|
47
|
+
# to submit the attendance sheet after the date has
|
47
48
|
# passed. Normally, timekeepers need to open and close
|
48
49
|
# an attendance sheet of a date on the specific date.
|
49
|
-
def
|
50
|
-
raise '
|
50
|
+
def submit
|
51
|
+
raise 'This attendance sheet is not open. Therefore it cannot be submitted' unless status == OPEN
|
51
52
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
53
|
+
self.closed_at = Time.now
|
54
|
+
self.status = SUBMITTED
|
55
|
+
save
|
56
|
+
self
|
56
57
|
end
|
57
58
|
end
|
58
59
|
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.1.
|
4
|
+
version: 1.1.15
|
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-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aasm
|