op_cart 0.5.2 → 0.5.3

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
  SHA1:
3
- metadata.gz: 3f02ef8a5af017815cb06b3d09db56e03c57c59f
4
- data.tar.gz: bad1b5aa4977f437499b51ede718d5f9335cb3df
3
+ metadata.gz: 189c8a856cf652828be2f78169e4bbfbde69c979
4
+ data.tar.gz: 1ce823a4230ccc8393aabfcdbdc583f9b79bff50
5
5
  SHA512:
6
- metadata.gz: bb81f925457e7f4d9b2b83f836b6806e1dc65388b3e376d539decbf7378367ba87a529fe7654ddd52b8ff97ca324c5159d5c4d134af6b619d3e306e0b4f0d9af
7
- data.tar.gz: 5161278ed86bd456df1aaac29b435700da74363a672b5fd9b8b01dff3457457b3234f247a4c6d44e54ca644c652d6b2058074772a967871c5c0e542bb48056b0
6
+ metadata.gz: 85c558b86db26f6a03321828d2deeddd5789e021940932bf66b1a0d9e9d4e9f7db235c8710737e86fff3a2ff63c4e264a7b65e8cb61820ba14037780a999c165
7
+ data.tar.gz: 3bbec259b17a6e3ac46c19573cde8c10c8b0bc610c4a911e378a49abf52e119a77c3406addad883114b5a7740eba0be1152eece9329e56ca58cdcccf532c56e5
@@ -73,7 +73,7 @@ module OpCart
73
73
  li_quantities_json.each do |plan_id, quantity|
74
74
  plan = Plan.find plan_id
75
75
  @order.line_items << LineItem.new(sellable: plan, quantity: quantity)
76
- plan.plan_addons.each do |addon|
76
+ plan.plan_addons.purchasable.each do |addon|
77
77
  @order.line_items << LineItem.new(sellable: addon.product, quantity: quantity)
78
78
  end
79
79
  end
@@ -30,7 +30,7 @@ module OpCart
30
30
 
31
31
  def validate_plan_addons_included
32
32
  unless line_items.flat_map do |li|
33
- if li.sellable.is_a?(Plan) && (addons = li.sellable.plan_addons).present?
33
+ if li.sellable.is_a?(Plan) && (addons = li.sellable.plan_addons.purchasable).present?
34
34
  addons.map do |addon|
35
35
  addon_li = line_items.select{|pali| pali.sellable == addon.product }
36
36
  addon_li.count == 1 && addon_li[0].quantity == li.quantity
@@ -23,7 +23,7 @@ module OpCart
23
23
  end
24
24
 
25
25
  def addons_price
26
- plan_addons.reduce(0) { |total, addon| total += addon.product.price }
26
+ plan_addons.purchasable.reduce(0) { |total, addon| total += addon.product.price }
27
27
  end
28
28
 
29
29
  private
@@ -3,5 +3,7 @@ module OpCart
3
3
  belongs_to :plan
4
4
  belongs_to :product
5
5
  belongs_to :user
6
+
7
+ scope :purchasable, -> { joins(:product).where op_cart_products: { allow_purchases: true } }
6
8
  end
7
9
  end
@@ -1,3 +1,3 @@
1
1
  module OpCart
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: op_cart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Boehs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-12 00:00:00.000000000 Z
11
+ date: 2015-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails