dscf-marketplace 0.13.4 → 0.13.5
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ac67a4d6ccac52aad74574a62d841183717112bad1c093526a9b9966421a4747
|
|
4
|
+
data.tar.gz: e11523f30c6f601d8bad9f14c271a8077354d79e21c3a23bb991779f8c8f8cf7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3468066de76f24decf7c547c0eb3b28044607082b64163251d667f3f8754adad9e47d2a0dfb99f91d93dd07c0595ad01e7dc896d77d222b9b4c25cfcf3598188
|
|
7
|
+
data.tar.gz: 88a186edeb669c7d90fda622a7c5a4835d4479f1d80064d926cbd396ed09c800efb3da3cb34ddd3e67b0269cc81ef6bc8d7454456b6cc5b5e3bf3805d8df48f4
|
|
@@ -15,7 +15,11 @@ module Dscf::Marketplace
|
|
|
15
15
|
enum :source_kind, {catalog: 0, supplier: 1, sub_supplier: 2}, default: :catalog
|
|
16
16
|
|
|
17
17
|
validates :price, numericality: {greater_than: 0}, presence: true
|
|
18
|
-
|
|
18
|
+
# Quantity must be positive while the listing is orderable, but a sold-out
|
|
19
|
+
# listing legitimately holds 0 — that's exactly the state set when the last
|
|
20
|
+
# unit is purchased (order creation decrements to 0 and flips to :sold_out).
|
|
21
|
+
validates :quantity, presence: true, numericality: {greater_than_or_equal_to: 0}
|
|
22
|
+
validates :quantity, numericality: {greater_than: 0}, unless: :sold_out?
|
|
19
23
|
validates :aggregator, presence: true
|
|
20
24
|
|
|
21
25
|
# Each kind requires (and is unique on) exactly one reference.
|
|
@@ -14,7 +14,11 @@ module Dscf::Marketplace
|
|
|
14
14
|
|
|
15
15
|
# Validations
|
|
16
16
|
validates :price, numericality: {greater_than: 0}, presence: true
|
|
17
|
-
|
|
17
|
+
# Quantity must be positive while the listing is orderable, but a sold-out
|
|
18
|
+
# listing legitimately holds 0 — that's exactly the state set when the last
|
|
19
|
+
# unit is purchased (order creation decrements to 0 and flips to :sold_out).
|
|
20
|
+
validates :quantity, presence: true, numericality: {greater_than_or_equal_to: 0}
|
|
21
|
+
validates :quantity, numericality: {greater_than: 0}, unless: :sold_out?
|
|
18
22
|
validates :business_id, presence: true
|
|
19
23
|
validates :supplier_product_id, presence: true
|
|
20
24
|
|