tiny_builder 0.2.4 → 0.2.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8dbf4464a0ba8a69a013088f5905e51fd5317ab25cc73cd68899532ba72b6bc
4
- data.tar.gz: c714ea7c8353c7bba0d4f87196b3ff70277abdd38974a9e93946cb8220fe5c9e
3
+ metadata.gz: 3b1aa960d2ca0a701307b0e42a87cfaa04fb1cc79e7b6c93edea686475cb60ec
4
+ data.tar.gz: cde6147e66a52b4ea53266c5f6bda5717caa4b1a3e4e8a65955887d28dca9cf1
5
5
  SHA512:
6
- metadata.gz: f2e605f5d05efbe4a2287063a59da8a33ce7acc01da2af36341198cb37f7288052f3d81596e8badea6ec4e033cce4fa9ac3662e8359c4141529b2446063b4bc4
7
- data.tar.gz: 3886feb17d84a0dc62edf3816d1407371b5b27f1118195f997de9e3d65c51134e0c552e42f01049173b1471dff16c945c4b3c00ed50c146242287854b8c81914
6
+ metadata.gz: ca74c43055014bc237dd433bc26ae4487f1b98b2aaa4921957c73efab706d476e7e1ea6acbeda0395346225be64e03c07570af2c7ca59801a0a19dd80991e1af
7
+ data.tar.gz: 6162db162dd9dbacd5cf67d399c89d01911f66bdc2a4d2462c6c0dc32f38ed93cab5bb57a988bb353764b90d7eadc705dfecd64506518d7ceb04089d31e0e4c3
@@ -25,13 +25,10 @@ class TinyBuilder
25
25
  end
26
26
 
27
27
  def warehouse_stock
28
- case variant.config.downcase
29
- when 'default'
28
+ if bundle?
29
+ qty_bundle
30
+ else
30
31
  qty_default(warehouse_space)
31
- when 'free gift', 'combo'
32
- qty_bundle
33
- else
34
- raise "config not recognize => #{variant.config}"
35
32
  end
36
33
  end
37
34
 
@@ -86,5 +83,10 @@ class TinyBuilder
86
83
  return [] unless bundle
87
84
  bundle.bundle_variants.select { |bv| !bv[:main] }
88
85
  end
86
+
87
+ def bundle?
88
+ product = MasterProduct.find_by("variants.id": variant.id)
89
+ product.variants.find{|v| v["id"] == variant.id}["bundle_id"].present?
90
+ end
89
91
  end
90
92
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class TinyBuilder
4
- VERSION = '0.2.4'
4
+ VERSION = '0.2.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - hayakaza
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-05 00:00:00.000000000 Z
11
+ date: 2025-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler