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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13b98b025e67870310c1c5a59ed49190f520ac69c4f4f66d6d6e59c3887b0e56
|
4
|
+
data.tar.gz: 4403b249eb4659a7198c27d218b4df9d84bcd352933540f093f44d150f837e68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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, :
|
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
|
-
|
19
|
-
|
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
|
data/lib/comee/core/version.rb
CHANGED