cats_core 1.5.11 → 1.5.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/cats/core/dispatch_transactions_controller.rb +2 -1
- data/app/controllers/cats/core/receipts_controller.rb +1 -1
- data/app/models/cats/core/dispatch_transaction.rb +1 -0
- data/app/models/cats/core/location.rb +3 -0
- data/app/models/cats/core/offer_item.rb +1 -1
- data/app/models/cats/core/receipt.rb +1 -0
- data/app/models/cats/core/round_plan_item_detail.rb +1 -0
- data/app/models/cats/core/unit_conversion.rb +2 -2
- data/app/serializers/cats/core/dispatch_transaction_serializer.rb +1 -1
- data/app/serializers/cats/core/location_serializer.rb +1 -1
- data/app/serializers/cats/core/receipt_serializer.rb +1 -1
- data/db/migrate/20221024081134_add_reference_no_to_cats_core_receipts.rb +5 -0
- data/db/migrate/20221024081141_add_reference_no_to_cats_core_dispatch_transactions.rb +5 -0
- data/lib/cats/core/version.rb +1 -1
- data/spec/factories/cats/core/dispatch_transactions.rb +1 -0
- data/spec/factories/cats/core/receipts.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ab42e1862e55f7fd4c141b694da468de2c4a6c3c093e6238a9159492edeaf04
|
4
|
+
data.tar.gz: 2e9e396b186d5389ab6930c61e243f914090a784127e67dda60dc2822801ffd8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b703a292db548f017176d762e143068063ec9121388e7e834d32f4042fe6ba1af438236f30cc9964c86b219d58c8dcb6869294645225de24e10369f3cb231c96
|
7
|
+
data.tar.gz: b90cea5c544273ad3ae0302b5e444e4041a5deaa4343b64a32a68d4831804a0aae45a3b9ac072c3629bff987a3bd0c2556183131d94f6c9c2c5a58db798c8c8f
|
@@ -37,7 +37,8 @@ module Cats
|
|
37
37
|
private
|
38
38
|
|
39
39
|
def model_params
|
40
|
-
params.require(:payload).permit(:source_id, :dispatch_authorization_id, :transaction_date, :quantity, :unit_id
|
40
|
+
params.require(:payload).permit(:source_id, :dispatch_authorization_id, :transaction_date, :quantity, :unit_id,
|
41
|
+
:reference_no)
|
41
42
|
end
|
42
43
|
end
|
43
44
|
end
|
@@ -7,6 +7,7 @@ module Cats
|
|
7
7
|
belongs_to :dispatch_authorization
|
8
8
|
|
9
9
|
validates :source_id, uniqueness: { scope: :dispatch_authorization_id }
|
10
|
+
validates :reference_no, presence: true
|
10
11
|
validate :validate_dispatch
|
11
12
|
validate :validate_source_quantity, :validate_authorized_quantity, unless: :skip_quantity_validation
|
12
13
|
|
@@ -17,6 +17,9 @@ module Cats
|
|
17
17
|
validates :location_type, inclusion: { in: LOCATION_TYPES }
|
18
18
|
validate :validate_location_parent
|
19
19
|
|
20
|
+
delegate(:code, to: :parent, prefix: true, allow_nil: true)
|
21
|
+
delegate(:name, to: :parent, prefix: true, allow_nil: true)
|
22
|
+
|
20
23
|
def validate_location_parent
|
21
24
|
parents = {
|
22
25
|
REGION => [],
|
@@ -4,7 +4,7 @@ module Cats
|
|
4
4
|
belongs_to :transport_offer
|
5
5
|
belongs_to :transport_bid_item
|
6
6
|
|
7
|
-
validates :price, presence: true, numericality: {
|
7
|
+
validates :price, presence: true, numericality: { greater_than_or_equal_to: 0 }
|
8
8
|
validates :rank, numericality: { greater_than: 0 }, allow_nil: true
|
9
9
|
validate :validate_rank_is_set_for_winner
|
10
10
|
|
@@ -9,6 +9,7 @@ module Cats
|
|
9
9
|
validates :commodity_status, presence: true, inclusion: { in: Commodity::COMMODITY_STATUSES }
|
10
10
|
validates :commodity_grade, inclusion: { in: Commodity::COMMODITY_GRADES }, allow_nil: true
|
11
11
|
validates :quantity, presence: true, numericality: { greater_than: 0 }
|
12
|
+
validates :reference_no, presence: true
|
12
13
|
validate :validate_quantity
|
13
14
|
|
14
15
|
delegate(:abbreviation, to: :unit, prefix: true)
|
@@ -15,7 +15,7 @@ module Cats
|
|
15
15
|
return value if from == to
|
16
16
|
|
17
17
|
conversion = find_by(from: from, to: to)
|
18
|
-
return value * conversion.factor if conversion
|
18
|
+
return (value * conversion.factor).round(2) if conversion
|
19
19
|
|
20
20
|
# Check if there is reverse conversion entry defined
|
21
21
|
conversion = find_by(from: to, to: from)
|
@@ -23,7 +23,7 @@ module Cats
|
|
23
23
|
raise(StandardError, "Conversion factor between #{from.abbreviation} and #{to.abbreviation} not found.")
|
24
24
|
end
|
25
25
|
|
26
|
-
value / conversion.factor
|
26
|
+
(value / conversion.factor).round(2)
|
27
27
|
end
|
28
28
|
|
29
29
|
##
|
@@ -2,7 +2,7 @@ module Cats
|
|
2
2
|
module Core
|
3
3
|
class DispatchTransactionSerializer < ActiveModel::Serializer
|
4
4
|
attributes :id, :source_id, :source_code, :dispatch_authorization_id, :quantity, :transaction_date, :status,
|
5
|
-
:unit_id, :unit_abbreviation
|
5
|
+
:unit_id, :unit_abbreviation, :reference_no
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -2,7 +2,7 @@ module Cats
|
|
2
2
|
module Core
|
3
3
|
class ReceiptSerializer < ActiveModel::Serializer
|
4
4
|
attributes :id, :receipt_authorization_id, :commodity_status, :commodity_grade, :quantity, :remark,
|
5
|
-
:unit_id, :unit_abbreviation
|
5
|
+
:unit_id, :unit_abbreviation, :reference_no
|
6
6
|
end
|
7
7
|
end
|
8
8
|
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.5.
|
4
|
+
version: 1.5.13
|
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-10
|
11
|
+
date: 2022-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -475,6 +475,8 @@ files:
|
|
475
475
|
- db/migrate/20220626063757_create_cats_core_swaps.rb
|
476
476
|
- db/migrate/20220626132050_create_cats_core_round_beneficiaries.rb
|
477
477
|
- db/migrate/20220923190857_create_cats_core_application_settings.rb
|
478
|
+
- db/migrate/20221024081134_add_reference_no_to_cats_core_receipts.rb
|
479
|
+
- db/migrate/20221024081141_add_reference_no_to_cats_core_dispatch_transactions.rb
|
478
480
|
- lib/cats/core.rb
|
479
481
|
- lib/cats/core/engine.rb
|
480
482
|
- lib/cats/core/version.rb
|