effective_orders 1.5.3 → 1.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/effective/datatables/orders.rb +16 -8
- data/lib/effective_orders/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69ff7ff6e5414d61ae7a6fc8982f4975917e72ac
|
4
|
+
data.tar.gz: d7dc79b1ccba44c64636c436ee4adc58bc0b6253
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a8641f98c31e8eaf05efc5d3ec699cd68a6ad1c4fb429349d45303c685958848e0e1fb3b1a402e658b35a42e86945535a791f2e3641d3c4aadc8074efb921c9
|
7
|
+
data.tar.gz: 2ed81e8f55fbaa86af4428f89598a189da0abf147bbf4233098383d5cfc080270ccf4440d7f5ded06a27ad24bcc9f25d2c0a990fbe0c92e29c1bf979191e5f16
|
@@ -29,6 +29,7 @@ if defined?(EffectiveDatatables)
|
|
29
29
|
end
|
30
30
|
|
31
31
|
table_column(:total) { |order| price_to_currency(order[:total].to_i) }
|
32
|
+
table_column :payment_method
|
32
33
|
|
33
34
|
table_column :created_at, :visible => false
|
34
35
|
table_column :updated_at, :visible => false
|
@@ -70,15 +71,22 @@ if defined?(EffectiveDatatables)
|
|
70
71
|
'SUM((order_items.price * order_items.quantity) + (CASE order_items.tax_exempt WHEN true THEN 0 ELSE ((order_items.price * order_items.quantity) * order_items.tax_rate) END))'
|
71
72
|
end
|
72
73
|
|
74
|
+
def query_payment_method
|
75
|
+
"SUBSTRING(payment FROM 'card: (\\w{1,2})\\n')"
|
76
|
+
end
|
77
|
+
|
73
78
|
def search_column(collection, table_column, search_term)
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
case table_column[:name]
|
80
|
+
when 'subtotal'
|
81
|
+
then collection.having("#{query_subtotal} = ?", (search_term.gsub(/[^0-9.]/, '').to_f * 100.0).to_i)
|
82
|
+
when 'tax'
|
83
|
+
then collection.having("#{query_tax} = ?", (search_term.gsub(/[^0-9.]/, '').to_f * 100.0).to_i)
|
84
|
+
when 'total'
|
85
|
+
then collection.having("#{query_total} = ?", (search_term.gsub(/[^0-9.]/, '').to_f * 100.0).to_i)
|
86
|
+
when 'purchase_state'
|
87
|
+
then search_term == 'abandoned' ? collection.where(purchase_state: nil) : super
|
88
|
+
when 'payment_method'
|
89
|
+
then collection.having("#{query_payment_method} = ?", search_term)
|
82
90
|
else
|
83
91
|
super
|
84
92
|
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: 1.5.
|
4
|
+
version: 1.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: 2015-10-
|
11
|
+
date: 2015-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|