item_builder_mwh 0.1.32 → 0.1.33
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: c282ebc9226e7ecefba32a5b1b090497d55d2ae0348e4bce59fd85778f5b86bd
|
4
|
+
data.tar.gz: 39e5261db0a0b8db5d273e6c51e00263a6653784c040ee8535c68a19d7212d1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc90d9146267c005d720d6b3fc5e17253d3fa0021577476ece017baed78105c68173167859a30722b2bec3137dbc150bb2abfdf53ef822dda3807259e728dda6
|
7
|
+
data.tar.gz: a1b92a340806454c47d766c8008861cd5d53fb0d58ac46f0cd39d20a7d29745d4890f116c1c8397117923083a486023a5a998f0b79df5a5f94980680dafff2bc
|
@@ -13,6 +13,7 @@ class ItemBuilderMwh
|
|
13
13
|
@existing_allocated_stock = args.fetch(:existing_allocated_stock)
|
14
14
|
@listing_wh_sp_quantity = args.fetch(:listing_wh_sp_quantity)
|
15
15
|
@wh_routing = args.fetch(:wh_routing, 0)
|
16
|
+
@selected_warehouse_space = args.fetch(:selected_warehouse_space)
|
16
17
|
end
|
17
18
|
|
18
19
|
def perform
|
@@ -96,9 +97,8 @@ class ItemBuilderMwh
|
|
96
97
|
if @bundle_variants.present?
|
97
98
|
qty_list = []
|
98
99
|
@bundle_variants.each do |bvr|
|
99
|
-
|
100
|
-
qty =
|
101
|
-
qty ||= 0
|
100
|
+
qty_wh_spaces = wh_space.select {|ws| ws.item_variant_id == bvr.variant_id }
|
101
|
+
qty = qty_wh_spaces.sum(&:quantity)
|
102
102
|
qty = qty / bvr.unit
|
103
103
|
qty_list.push(qty)
|
104
104
|
end
|
@@ -109,7 +109,7 @@ class ItemBuilderMwh
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def wh_space
|
112
|
-
@wh_space ||= WarehouseSpace.where(item_variant_id: variant_ids)
|
112
|
+
@wh_space ||= WarehouseSpace.where(item_variant_id: variant_ids, warehouse_id: @selected_warehouse_space.warehouse_id)
|
113
113
|
end
|
114
114
|
|
115
115
|
def variant_ids
|
@@ -43,24 +43,24 @@ class ItemBuilderMwh
|
|
43
43
|
|
44
44
|
def real_quantity(warehouse_space)
|
45
45
|
if channel_name == 'Zilingo'
|
46
|
-
qty(warehouse_space
|
46
|
+
qty(warehouse_space)
|
47
47
|
else
|
48
|
-
[qty(warehouse_space
|
48
|
+
[qty(warehouse_space), 0].sort[1]
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
def qty(
|
52
|
+
def qty(warehouse_space)
|
53
53
|
if channel_name.empty? || channel_name == "Shopify"
|
54
|
-
available_quantity(
|
54
|
+
available_quantity(warehouse_space)
|
55
55
|
else
|
56
|
-
qty_channel(
|
56
|
+
qty_channel(warehouse_space)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
def qty_channel(
|
60
|
+
def qty_channel(warehouse_space)
|
61
61
|
class_name = "ItemBuilderMwh::Modes::Quantity::#{channel_name}Service"
|
62
62
|
qty_channel_service = class_name.constantize
|
63
|
-
qty_channel_service.new(listing, available_quantity(
|
63
|
+
qty_channel_service.new(listing, available_quantity(warehouse_space), local_qty.to_i).perform
|
64
64
|
end
|
65
65
|
|
66
66
|
def channel_name
|
@@ -95,12 +95,13 @@ class ItemBuilderMwh
|
|
95
95
|
0
|
96
96
|
end
|
97
97
|
|
98
|
-
def available_quantity(
|
98
|
+
def available_quantity(warehouse_space)
|
99
99
|
ItemBuilderMwh::GetQuantityService.new(
|
100
100
|
listing: listing, stock_alloc: stock_alloc,
|
101
101
|
variant: variant, bundle_variants: bundle_variants,
|
102
102
|
existing_allocated_stock: existing_allocated_stock,
|
103
|
-
listing_wh_sp_quantity:
|
103
|
+
listing_wh_sp_quantity: warehouse_space.quantity, wh_routing: wh_routing,
|
104
|
+
selected_warehouse_space: warehouse_space
|
104
105
|
).perform
|
105
106
|
end
|
106
107
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: item_builder_mwh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.33
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Ivander
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|