spree_cm_commissioner 2.8.0.pre.patch2 → 2.8.0.pre.patch3
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/Gemfile.lock +1 -1
- data/app/models/spree_cm_commissioner/inventory_item.rb +7 -4
- data/lib/spree_cm_commissioner/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 76637432e996b37ca03c838a76d393a144f0496c364591be35b7fee69d4020c3
|
|
4
|
+
data.tar.gz: 20fc8d9b5889475f5b11826d59380c13a8ef414f2006befa6a4d0bb7fd6395a8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1226aa03736bc82f722c9a8c2c32bafb2edfeae4dff4677fedcab0e3b3d617b01b81552d67dcb3bade8b3c8ded515cd9c1de7d7e8e4ac74dbc7deb556af01f25
|
|
7
|
+
data.tar.gz: e06a1fe22fa97440e84bcf331ffb57aa3cb163a9e5bebb369d38fa0796aa51ff43a143369bada379fa9d9f38e5b61c2a37d7e5e102666eb1cf84b96a45310520
|
data/Gemfile.lock
CHANGED
|
@@ -25,13 +25,16 @@ module SpreeCmCommissioner
|
|
|
25
25
|
|
|
26
26
|
after_commit :schedule_product_cache_invalidation
|
|
27
27
|
|
|
28
|
+
# Only for ecommerce: the app uses product.in_stock? (derived from quantity_available) for product cards.
|
|
29
|
+
# Other types (e.g. accommodation, bus) have many inventory items (including daily-generated ones),
|
|
30
|
+
# so invalidating per item would flood the task queue.
|
|
31
|
+
#
|
|
32
|
+
# This is temporary until we have a more robust cache invalidation strategy in place.
|
|
28
33
|
def schedule_product_cache_invalidation
|
|
34
|
+
return unless ecommerce?
|
|
29
35
|
return unless saved_change_to_quantity_available?
|
|
30
36
|
|
|
31
|
-
# Only
|
|
32
|
-
# - out-of-stock → in-stock (0 → N): invalidate
|
|
33
|
-
# - in-stock → out-of-stock (N → 0): invalidate
|
|
34
|
-
# - non-zero to non-zero (5 → 3): skip — cached in_stock value is unchanged
|
|
37
|
+
# Only fires on in_stock status transition (0 ↔ N); non-zero to non-zero changes are skipped.
|
|
35
38
|
old_val, new_val = saved_change_to_quantity_available
|
|
36
39
|
return if old_val.to_i.positive? && new_val.to_i.positive?
|
|
37
40
|
|