effective_orders 6.24.0 → 6.24.2

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: 9da5a3039ab999f6469ee93178d23257c81724a4532548e536af212e082ea782
4
- data.tar.gz: 94e9f7086405b091105bb47ffd9d7fc4181c04f9eba5cdfd1f176285959d2c91
3
+ metadata.gz: 92f82229bbfabfdb94cd12f4155853a6f7a18ee196373404ad2b24525a84155b
4
+ data.tar.gz: 3f7bf5b05d87d50f3e86fb275d7f4f610210cd3fd2c3ddcbf85b3620e35d6de5
5
5
  SHA512:
6
- metadata.gz: ebb63ef8c77027aef6a2fa831a14c96e22044746f208054c364d556b458f137adf16fb357ae60b00b09c1eb45a11208b9f2ac879548be8ccad1e9c87a0dbd6da
7
- data.tar.gz: 83182d0a3220cdf5cf6ea93c7828fc90d8d3c124b4e48a9f3e54a50693de6b77bb087cf64a6da5ebfe30204a0d20d1ee6bc3d5909139cb2890f64cb82fc0e36d
6
+ metadata.gz: fbeda4073c818295729b10718d3b3ad96f238d1e4659ca2fac0e1de7070335ab4e85f05438e684eef5992c35ffc0cc2c1f739fb91028db0a6f3b0b5833b80b46
7
+ data.tar.gz: 3dd836f02ed0972487a7739a7550384cdd3a3ef15d67174914cc644b280eecf82f27123e98f84ca66bae033d8279846b8c4776931e87f90df7e46d65fd23b1a4
@@ -15,6 +15,10 @@ module Admin
15
15
  col :returns, as: :price
16
16
  col :total, as: :price
17
17
 
18
+ col :orders_count, visible: false
19
+
20
+ col :users, visible: false
21
+
18
22
  col :filtered_start_date, as: :date, search: false, sort: false, visible: false do
19
23
  date_range.begin&.strftime('%F')
20
24
  end
@@ -23,6 +27,16 @@ module Admin
23
27
  date_range.end&.strftime('%F')
24
28
  end
25
29
 
30
+ col(:orders, col_class: 'col-actions', search: false, sort: false) do |orders, row|
31
+ if orders.present?
32
+ title = pluralize(orders.length, 'orders')
33
+ order_ids = orders.map(&:id).join("|")
34
+
35
+ path = effective_orders.nested_orders_admin_order_reports_path(ids: order_ids)
36
+ nested_datatable_link_to(title, path, title: row.first)
37
+ end
38
+ end
39
+
26
40
  aggregate :total
27
41
  end
28
42
 
@@ -30,10 +44,11 @@ module Admin
30
44
  start_date = date_range.begin&.strftime('%F')
31
45
  end_date = date_range.end&.strftime('%F')
32
46
 
33
- orders = Effective::Order.purchased.where(purchased_at: date_range).where('total != 0')
47
+ orders = Effective::Order.purchased.where(purchased_at: date_range).where('total != 0').includes(:user)
34
48
  order_items = Effective::OrderItem.where(order_id: orders).includes(:purchasable, order: :user)
35
49
 
36
50
  payment_providers.map do |provider|
51
+ provider_orders = orders.select { |order| order.payment_provider == provider }
37
52
  items = order_items.select { |item| item.order.payment_provider == provider }
38
53
 
39
54
  [
@@ -41,8 +56,11 @@ module Admin
41
56
  items.sum { |item| (item.total > 0 ? item.total : 0) }.to_i,
42
57
  items.sum { |item| (item.total < 0 ? item.total : 0) }.to_i,
43
58
  items.sum { |item| item.total }.to_i,
59
+ provider_orders.length,
60
+ provider_orders.map(&:user),
44
61
  start_date,
45
- end_date
62
+ end_date,
63
+ provider_orders
46
64
  ]
47
65
  end
48
66
  end
@@ -20,15 +20,6 @@ module Admin
20
20
 
21
21
  col :orders_count, visible: false
22
22
 
23
- col(:orders, col_class: 'col-actions') do |orders|
24
- if orders.present?
25
- title = pluralize(orders.length, 'orders')
26
- order_ids = orders.map(&:id).join("|")
27
-
28
- path = effective_orders.nested_orders_admin_order_reports_path(ids: order_ids)
29
- nested_datatable_link_to(title, path)
30
- end
31
- end
32
23
 
33
24
  col :users, visible: false
34
25
 
@@ -40,6 +31,16 @@ module Admin
40
31
  date_range.end&.strftime('%F')
41
32
  end
42
33
 
34
+ col(:orders, col_class: 'col-actions', search: false, sort: false) do |orders, row|
35
+ if orders.present?
36
+ title = pluralize(orders.length, 'orders')
37
+ order_ids = orders.map(&:id).join("|")
38
+
39
+ path = effective_orders.nested_orders_admin_order_reports_path(ids: order_ids)
40
+ nested_datatable_link_to(title, path, title: row.first)
41
+ end
42
+ end
43
+
43
44
  aggregate :total
44
45
  end
45
46
 
@@ -66,10 +67,10 @@ module Admin
66
67
 
67
68
  row += [
68
69
  orders.length,
69
- orders,
70
70
  orders.map(&:user),
71
71
  start_date,
72
- end_date
72
+ end_date,
73
+ orders
73
74
  ]
74
75
 
75
76
  row
@@ -20,16 +20,6 @@ module Admin
20
20
 
21
21
  col :orders_count, visible: false
22
22
 
23
- col(:orders, col_class: 'col-actions') do |orders|
24
- if orders.present?
25
- title = pluralize(orders.length, 'orders')
26
- order_ids = orders.map(&:id).join("|")
27
-
28
- path = effective_orders.nested_orders_admin_order_reports_path(ids: order_ids)
29
- nested_datatable_link_to(title, path)
30
- end
31
- end
32
-
33
23
  col :users, visible: false
34
24
 
35
25
  col :start_date, as: :date, search: false, sort: false, visible: false do
@@ -40,6 +30,16 @@ module Admin
40
30
  date_range.end&.strftime('%F')
41
31
  end
42
32
 
33
+ col(:orders, col_class: 'col-actions', search: false, sort: false) do |orders, row|
34
+ if orders.present?
35
+ title = pluralize(orders.length, 'orders')
36
+ order_ids = orders.map(&:id).join("|")
37
+
38
+ path = effective_orders.nested_orders_admin_order_reports_path(ids: order_ids)
39
+ nested_datatable_link_to(title, path, title: row.first)
40
+ end
41
+ end
42
+
43
43
  aggregate :total
44
44
  end
45
45
 
@@ -66,10 +66,10 @@ module Admin
66
66
 
67
67
  row += [
68
68
  orders.length,
69
- orders,
70
69
  orders.map(&:user),
71
70
  start_date,
72
- end_date
71
+ end_date,
72
+ orders
73
73
  ]
74
74
 
75
75
  row
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '6.24.0'.freeze
2
+ VERSION = '6.24.2'.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: 6.24.0
4
+ version: 6.24.2
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: 2025-05-06 00:00:00.000000000 Z
11
+ date: 2025-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails