effective_orders 4.5.3 → 4.5.4
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/app/models/effective/order.rb +7 -3
- data/lib/effective_orders/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0144e9b8480285f5329cdb80f310ae893afc715ef1515a9d466d19075e5f0795
|
4
|
+
data.tar.gz: c4f7848248c853fc25f8123113cb863087ed92b0cfc01b78f85892ea09bb24ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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 =
|
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)
|
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.
|
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-
|
11
|
+
date: 2020-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|