product_update_single 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/product_update_single/version.rb +1 -1
- data/lib/product_update_single.rb +8 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13062840871c5762c1dbf64b42f60aec627460a3
|
4
|
+
data.tar.gz: 4807e57c0b0701b4ea742b2abcf318f632a1db31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29388a8f5a2b142953e3a9b0d0dc3e3e7183be88123cdabb821339b261b754c535285c75b1080f435859c6c605140eca913846a910da83653eb09e1b51aff7ee
|
7
|
+
data.tar.gz: 910ff12039647638a0685e8d7f0bd9a6c7b32619b4ab32dbf0641954842627d79492949232ce55d35b95d4c45b36d2a51ce9f913e06842bc5489d351cb299e4e
|
@@ -35,9 +35,15 @@ class ProductUpdateSingleton
|
|
35
35
|
@order_record = OrderItem.where(order_id: @order_confirmed.id)
|
36
36
|
@order_record.each do |order_record|
|
37
37
|
@product_count_update = Product.find(order_record.product_id)
|
38
|
+
if(@product_count_update.count?)
|
39
|
+
puts(@product_count_update)
|
40
|
+
@product_count_update.count += order_record.quantity
|
41
|
+
else
|
42
|
+
@product_count_update.count = 0
|
43
|
+
@product_count_update.count += order_record.quantity
|
44
|
+
end
|
38
45
|
puts("inside count update function and order item should have been initiated by now")
|
39
|
-
|
40
|
-
@product_count_update.quantityAvailable -= order_record.quantity
|
46
|
+
#@product_count_update.quantityAvailable -= order_record.quantity
|
41
47
|
@product_count_update.save
|
42
48
|
end
|
43
49
|
puts("count update should be completed by now and quantity of product ordered should be have been subtracted in the product")
|