cats_core 1.1.36 → 1.1.37
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/cats/core/allocation_item.rb +1 -0
- data/app/models/cats/core/dispatch.rb +1 -0
- data/lib/cats/core/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f07fe2e24b72c5cf2c4c7d7c9acd92332e6e7a80b4d9305fdffcbb94365fb67e
|
4
|
+
data.tar.gz: 6c343a483c11b17757966c650fa355a541a62483eafa9d6ad5b5428ebb1aef63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c7a27a3e6babd99f6e331c63d6d79ecfb6af34e5c6ae746ccd538d11e1ea62e48ea9c6b4b84eb5d1500da1466992f2acae40297127e5822c12b4f8ed418a728
|
7
|
+
data.tar.gz: 930ccb77011e1cabc7ce9851fe22584f50346d1494d4556df7df90159fb9f2d99b3340c0f9ff1f7f5cc0a7b334f5274e74b67191d48abecf709f04af27b553b5
|
@@ -22,6 +22,7 @@ module Cats
|
|
22
22
|
|
23
23
|
allocated = AllocationItem.where(allocation: allocation).sum(:quantity)
|
24
24
|
remaining = allocation.quantity - allocated
|
25
|
+
remaining += quantity_was if quantity_was
|
25
26
|
errors.add(:quantity, "exceeds allocated quantity. Maximum allowed is #{remaining}") if quantity > remaining
|
26
27
|
end
|
27
28
|
|
@@ -32,6 +32,7 @@ module Cats
|
|
32
32
|
|
33
33
|
dispatched = Dispatch.where(allocation_item: allocation_item).sum(:quantity)
|
34
34
|
remaining = allocation_item.quantity - dispatched
|
35
|
+
remaining += quantity_was if quantity_was
|
35
36
|
errors.add(:quantity, "exceeds allocated quantity. Maximum allowed is #{remaining}") if quantity > remaining
|
36
37
|
end
|
37
38
|
|
data/lib/cats/core/version.rb
CHANGED