cats_core 1.4.5 → 1.4.8
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: 626e9d30bfefd23124b2110a3b10c4a6dcf58ac6aeb660b50803843ececd2517
|
4
|
+
data.tar.gz: e59fa35f07c89486a5840e613389dd75ed6613077cb0ae3648295134dbff7ffe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 440d92d2388b2816b1c76b0040d4c6d2a2fe0588b94e4ba134be56058cb74344ad55510e074a9d87ee04b1bf5336a705dd98bc7de5facc7250f3638f17e9ddfd
|
7
|
+
data.tar.gz: f3adb1d2cc5edd7cf7baf0eeb4b9624602f0987bea3cb5d1b7700af7b894ac43143fc2c0108daed5622e55e5581fc789ae97bd073a2246fdd02836bcb060784a
|
@@ -16,13 +16,26 @@ module Cats
|
|
16
16
|
validates :status, presence: true, inclusion: { in: STATUSES }
|
17
17
|
|
18
18
|
delegate(:full_name, to: :requested_by, prefix: 'requestor')
|
19
|
-
delegate(:full_name, to: :approved_by, prefix: 'approver')
|
19
|
+
delegate(:full_name, to: :approved_by, prefix: 'approver', allow_nil: true)
|
20
20
|
delegate(:abbreviation, to: :unit, prefix: true)
|
21
|
+
delegate(:reference_no, to: :dispatch_plan, prefix: true)
|
21
22
|
|
22
23
|
def quantity
|
23
24
|
quantities = transport_requisition_items.map { |item| UnitConversion.convert(item.unit, unit, item.quantity) }
|
24
25
|
quantities.sum
|
25
26
|
end
|
27
|
+
|
28
|
+
def approve
|
29
|
+
raise(StandardError, 'Transport requisition is already approved.') if status == APPROVED
|
30
|
+
|
31
|
+
if transport_requisition_items.count.zero?
|
32
|
+
raise(StandardError, 'Transport requisition has no requisition items.')
|
33
|
+
end
|
34
|
+
|
35
|
+
self.status = APPROVED
|
36
|
+
save!
|
37
|
+
self
|
38
|
+
end
|
26
39
|
end
|
27
40
|
end
|
28
41
|
end
|
@@ -9,6 +9,14 @@ module Cats
|
|
9
9
|
|
10
10
|
delegate(:reference_no, to: :transport_requisition, prefix: 'requisition')
|
11
11
|
delegate(:abbreviation, to: :unit, prefix: true)
|
12
|
+
|
13
|
+
def commodity_name
|
14
|
+
dispatch_plan_item.commodity.source.commodity_category.name
|
15
|
+
end
|
16
|
+
|
17
|
+
def woreda
|
18
|
+
dispatch_plan_item.destination.name
|
19
|
+
end
|
12
20
|
end
|
13
21
|
end
|
14
22
|
end
|
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.4.
|
4
|
+
version: 1.4.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|