cats_core 1.2.22 → 1.2.23
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: 6fe0f87a2452fb8bcafe40ece45a769789b6b576cab27cdf0867507acc79338e
|
4
|
+
data.tar.gz: 967feac1199b16fe037295cb805c3cb9cf7234b37e03641af952bf1ffc7e624d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01ce4d95e2c647519e65a19b109a81229bae931aa0af07cf719f9a2f2322f4d8edc4c098e221a51af9577b64a394da4bd05dc8243e7a28837d8ea5482b2c2b56
|
7
|
+
data.tar.gz: e78386c0c8df0e6b8045de92d5235516e09937d044b7e0efee9505fc6b629b1589ee962e759ea17460e19f3caef58a4ad1554959bad138740aec29d870b3c932
|
@@ -4,7 +4,9 @@ module Cats
|
|
4
4
|
NEW = 'New'.freeze
|
5
5
|
OPEN = 'Open'.freeze
|
6
6
|
CLOSED = 'Closed'.freeze
|
7
|
-
|
7
|
+
RANKED = 'Ranked'.freeze
|
8
|
+
WINNERS_DECLARED = 'Winner Declared'.freeze
|
9
|
+
STATUSES = [NEW, OPEN, CLOSED, RANKED, WINNERS_DECLARED].freeze
|
8
10
|
|
9
11
|
has_many :transport_bid_items
|
10
12
|
|
data/lib/cats/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cats_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -295,8 +295,6 @@ files:
|
|
295
295
|
- app/models/cats/core/transport_bid_item.rb
|
296
296
|
- app/models/cats/core/transport_contract.rb
|
297
297
|
- app/models/cats/core/transport_offer.rb
|
298
|
-
- app/models/cats/core/transport_request.rb
|
299
|
-
- app/models/cats/core/transport_request_item.rb
|
300
298
|
- app/models/cats/core/transporter.rb
|
301
299
|
- app/models/cats/core/unit_of_measure.rb
|
302
300
|
- app/models/cats/core/user.rb
|
@@ -1,46 +0,0 @@
|
|
1
|
-
module Cats
|
2
|
-
module Core
|
3
|
-
class TransportRequest < ApplicationRecord
|
4
|
-
DRAFT = 'Draft'.freeze
|
5
|
-
APPROVED = 'Approved'.freeze
|
6
|
-
OPEN = 'Open'.freeze
|
7
|
-
CLOSED = 'Closed'.freeze
|
8
|
-
STATUSES = [DRAFT, APPROVED, OPEN, CLOSED].freeze
|
9
|
-
|
10
|
-
belongs_to :requested_by, class_name: 'Cats::Core::User'
|
11
|
-
belongs_to :approved_by, class_name: 'Cats::Core::User', optional: true
|
12
|
-
has_many :transport_request_items
|
13
|
-
|
14
|
-
validates :reference_no, :request_date, :status, presence: true
|
15
|
-
validates :reference_no, uniqueness: true
|
16
|
-
validates :status, inclusion: { in: STATUSES }
|
17
|
-
|
18
|
-
delegate(:full_name, to: :requested_by, prefix: true, allow_nil: true)
|
19
|
-
delegate(:full_name, to: :approved_by, prefix: true, allow_nil: true)
|
20
|
-
|
21
|
-
def approve(approver)
|
22
|
-
raise(StandardError, 'Request is not open for approval.') unless status == DRAFT
|
23
|
-
|
24
|
-
raise(StandardError, 'Request is empty.') if transport_request_items.count.zero?
|
25
|
-
|
26
|
-
self.approved_by = approver
|
27
|
-
self.status = APPROVED
|
28
|
-
save!
|
29
|
-
end
|
30
|
-
|
31
|
-
def open
|
32
|
-
raise(StandardError, 'Request is not approved for opening.') unless status == APPROVED
|
33
|
-
|
34
|
-
self.status = OPEN
|
35
|
-
save!
|
36
|
-
end
|
37
|
-
|
38
|
-
def close
|
39
|
-
raise(StandardError, 'Request is not open.') unless status == OPEN
|
40
|
-
|
41
|
-
self.status = CLOSED
|
42
|
-
save!
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Cats
|
2
|
-
module Core
|
3
|
-
class TransportRequestItem < ApplicationRecord
|
4
|
-
belongs_to :transport_request
|
5
|
-
belongs_to :source, class_name: 'Cats::Core::Location'
|
6
|
-
belongs_to :destination, class_name: 'Cats::Core::Location'
|
7
|
-
belongs_to :commodity
|
8
|
-
|
9
|
-
has_many :transport_offers
|
10
|
-
|
11
|
-
delegate(:name, to: :source, prefix: true)
|
12
|
-
delegate(:name, to: :destination, prefix: true)
|
13
|
-
delegate(:name, to: :commodity, prefix: true)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|