rawgento_db 0.3.0 → 0.3.1
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 +4 -4
- data/lib/rawgento_db/query.rb +11 -1
- data/lib/rawgento_db/version.rb +1 -1
- 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: 42a8499a9d74a242ecb3ebc681bd9ef9d25c2eb0
|
4
|
+
data.tar.gz: 73b829ce4f69600463080db5eb514e9bf36f483c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0ae5fecb54f19a25f234119e5e1d7b25210847716ec27fafc6adf6dce7499d49cea4931386493dba9c8777cb52452228b8ef836fc50c999554b80654e4205a5
|
7
|
+
data.tar.gz: 1c733a661c0e469c02345fba0a6644a8288daf0f92f16f97d82bcd4312d00e787091b29413953387c25dabf46b23a64ecfc0162bda9a5c0ba30c287e939d782c
|
data/lib/rawgento_db/query.rb
CHANGED
@@ -56,12 +56,22 @@ module RawgentoDB
|
|
56
56
|
"WHERE product_id = %d" % [stock_addition, product_id])
|
57
57
|
end
|
58
58
|
|
59
|
+
#def self.update_stock product_stock, settings=RawgentoDB.settings
|
60
|
+
# results = client(settings).query()
|
61
|
+
# # UPDATE cataloginventory_stock_item SET qty = CASE
|
62
|
+
# # WHEN id = 1 THEN qty + f
|
63
|
+
# # WHEN id = 2 THEN ‘War and Peace’
|
64
|
+
# # ...
|
65
|
+
# # END
|
66
|
+
# # WHERE id IN (1,2,...)
|
67
|
+
#end
|
68
|
+
|
59
69
|
# One-way ticket: Do set available if qty > 0 (but not unavailable if <= 0).
|
60
70
|
def self.set_available_on_stock product_id, settings=RawgentoDB.settings
|
61
71
|
result = client(settings).query(
|
62
72
|
"SELECT is_in_stock FROM cataloginventory_stock_item "\
|
63
73
|
"WHERE product_id = %d AND is_in_stock = 0 AND qty > 0" % product_id)
|
64
|
-
if result && result.size > 0
|
74
|
+
if result && result.size > 0 #&& result[0] == 0
|
65
75
|
result = client(settings).query(
|
66
76
|
"UPDATE cataloginventory_stock_item SET is_in_stock = 1 "\
|
67
77
|
"WHERE product_id = %d" % product_id)
|
data/lib/rawgento_db/version.rb
CHANGED