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: e713d41fece224efb5187e70f38a81a3bcb951579dbab893eb0602abdca2ded8
4
- data.tar.gz: 1beb16fefbd3e7d674fcf6854063665106d4b8858f015d396f656a23a4d37815
3
+ metadata.gz: ac67a4d6ccac52aad74574a62d841183717112bad1c093526a9b9966421a4747
4
+ data.tar.gz: e11523f30c6f601d8bad9f14c271a8077354d79e21c3a23bb991779f8c8f8cf7
5
5
  SHA512:
6
- metadata.gz: c48b573dd70627bc33628e66f304325b52c252cf1001fec0788ffc9266f47b3375772286bd9e0754f9f88ad811a6a5001fe6431c63fbb695f00ddc59eebad45a
7
- data.tar.gz: 8662c81c6b5942193a1b879f107d307666d38328186652d2f10fe6e4028280f86d96fb9b05c54f940c80a1e8af21c783ae033ce349691e8220ccb4f34f78c580
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
- validates :quantity, numericality: {greater_than: 0}, presence: true
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
- validates :quantity, numericality: {greater_than: 0}, presence: true
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
 
@@ -1,5 +1,5 @@
1
1
  module Dscf
2
2
  module Marketplace
3
- VERSION = "0.13.4".freeze
3
+ VERSION = "0.13.5".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dscf-marketplace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.4
4
+ version: 0.13.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Asrat