effective_orders 4.5.3 → 4.5.4

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: d2216991c7430e4902a33b35ee0d8d4ea9e637c927a587b1dbedf1eaf4cf57fe
4
- data.tar.gz: a51f8b35bfebb1e375664ee006e24717cec9ddac464f17e008296a87e2883c81
3
+ metadata.gz: 0144e9b8480285f5329cdb80f310ae893afc715ef1515a9d466d19075e5f0795
4
+ data.tar.gz: c4f7848248c853fc25f8123113cb863087ed92b0cfc01b78f85892ea09bb24ea
5
5
  SHA512:
6
- metadata.gz: 7b5a07d109578b5bc7654ca5eaa6ec3f18b7cd89841b15e7f0a5a1128089e9715cd9b317c884ef0afb6cb4a9fed7f0934b7693f7e0b3ba4648544769a00ef3be
7
- data.tar.gz: e94f3d309875b26bbf6f185990e80e1d1911ae0d320050550915dd7970f025a07645c402aa1b6422e114f1e1563b1d86420cba3a8d8058123ce437650c900269
6
+ metadata.gz: 06ed32afc06143accff761edb35b4018196558a9f3a76e6817be18e772f746acc84ec7ddc202f13713fc66316c64040518748116b2c68011d5d2358e5ad6be74
7
+ data.tar.gz: 11ffb123b02a984def655fae15a9c35a3f7f6266f7245faea219169090839683b7c17509295c99450443faa0cbb66ceb1b01a742008cab9b7e641ccb01990579
@@ -234,7 +234,7 @@ module Effective
234
234
  purchasable = item.purchasable
235
235
 
236
236
  if purchasable.blank? || purchasable.marked_for_destruction?
237
- item.mark_for_destruction
237
+ item.mark_for_destruction
238
238
  else
239
239
  item.price = purchasable.price
240
240
  end
@@ -487,13 +487,17 @@ module Effective
487
487
 
488
488
  def get_tax
489
489
  return nil unless tax_rate.present?
490
- order_items.reject { |oi| oi.tax_exempt? }.map { |oi| (oi.subtotal * (tax_rate / 100.0)).round(0).to_i }.sum
490
+ present_order_items.reject { |oi| oi.tax_exempt? }.map { |oi| (oi.subtotal * (tax_rate / 100.0)).round(0).to_i }.sum
491
491
  end
492
492
 
493
493
  private
494
494
 
495
+ def present_order_items
496
+ order_items.reject { |oi| oi.marked_for_destruction? }
497
+ end
498
+
495
499
  def assign_order_totals
496
- self.subtotal = order_items.map { |oi| oi.subtotal }.sum
500
+ self.subtotal = present_order_items.map { |oi| oi.subtotal }.sum
497
501
  self.tax_rate = get_tax_rate() unless (tax_rate || 0) > 0
498
502
  self.tax = get_tax()
499
503
  self.total = subtotal + (tax || 0)
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '4.5.3'.freeze
2
+ VERSION = '4.5.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_orders
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.3
4
+ version: 4.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-06 00:00:00.000000000 Z
11
+ date: 2020-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails