comee_core 0.1.34 → 0.1.35

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: 853a41c0984f1e95455e14a73caf7c2465a675876e82401cbadb6a000df33d91
4
- data.tar.gz: 30b4c242623351a53bb145f4d0138fe08d365a4f71b0edc0119696b6d09cb014
3
+ metadata.gz: 13b98b025e67870310c1c5a59ed49190f520ac69c4f4f66d6d6e59c3887b0e56
4
+ data.tar.gz: 4403b249eb4659a7198c27d218b4df9d84bcd352933540f093f44d150f837e68
5
5
  SHA512:
6
- metadata.gz: ba8920d5865d71fc83015e1fdb804f240f466cb8322b32ff4686777d85a2f846f2ab8110050d9250374466bb666eb44502218b199c2f8de3fbac0b4fe201d38b
7
- data.tar.gz: ed154ae6376c7a9ba14523cf71bac1a657c1a47301c677db656f05cda38da9f1dd80ab732ab68c78035124f265f389630737d210187d24f07b1a5696f10b923f
6
+ metadata.gz: 4070797618a46ce5da8102c5056c464bb688fc91fc802af00f9a6d8e3c5e24507bbd56fc4f9eeda2bbffa6c486cb0740b26a480ff01609f840fbad1efe47693c
7
+ data.tar.gz: ea97a4615f87b8ab8f1c6929d4c15c8c71f24229c58cf6cedbee93e19a9388b224763c2aa2ab0a4921d5456ae8fcd1d65964a07ece18a53f0dd1fe133a4897ed
@@ -18,7 +18,7 @@ module Comee
18
18
  private
19
19
 
20
20
  def model_params
21
- params.require(:payload).permit(:valid_from, :valid_to, :price, :status, :product_id, :discount, :client_id, :previous_price,
21
+ params.require(:payload).permit(:valid_from, :valid_to, :price, :product_id, :discount, :client_id, :previous_price,
22
22
  :unit_id)
23
23
  end
24
24
  end
@@ -15,8 +15,10 @@ module Comee
15
15
  def validate_primary_price
16
16
  return unless product && primary
17
17
 
18
- count = MasterPrice.where(product: product, primary: true, status: Price.statuses[:current]).count
19
- return unless count.positive? && primary && MasterPrice.statuses[status] == MasterPrice.statuses[:current]
18
+ prices = MasterPrice.where(product: product, primary: true)
19
+ unless prices.count.positive? && primary && MasterPrice.statuses[status] == MasterPrice.statuses[:current] && prices.first.id != id
20
+ return
21
+ end
20
22
 
21
23
  errors.add(:base, "There is already a primary price entry for item '#{product.code}'")
22
24
  end
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.1.34".freeze
3
+ VERSION = "0.1.35".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comee_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.34
4
+ version: 0.1.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.