effective_datatables 3.3.13 → 3.3.14
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/assets/stylesheets/effective_datatables/_overrides.scss +1 -0
- data/app/models/effective/datatable_value_tool.rb +1 -1
- data/app/models/effective/effective_datatable/compute.rb +4 -0
- data/app/models/effective/effective_datatable/resource.rb +5 -0
- data/lib/effective_datatables/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: ea8489f1a21f2dd9b48a0c3fdcceb3d9c3c1b705
|
4
|
+
data.tar.gz: 8c5c8d254c485bd5975aca3436bb82a5e0c51299
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 108b2f1856fee2aa9e153dd1baf76f0fa4a8a8b047ac8a9a36648fe7f657e33970d38d2afed2c3b4c0529e5938361a09b5efd020de0bcc026f68e16b3986d8f4
|
7
|
+
data.tar.gz: f54da3d46cf77a19b0626a8d51f12b33b95cb461d8642c72bea9286b40cfe4a7a5398582bbd24d7fc7eed54a55741f475f1306914266dd093df53626f7c46b8c
|
@@ -112,6 +112,10 @@ module Effective
|
|
112
112
|
elsif raw
|
113
113
|
aggregate_column(values, opts, aggregate)
|
114
114
|
else
|
115
|
+
if values.all? { |v| v.kind_of?(ActiveRecord::Base) && v.respond_to?(name) }
|
116
|
+
values = values.map { |v| (v[name] if opts[:sql_as_column]) || v.public_send(name) }
|
117
|
+
end
|
118
|
+
|
115
119
|
format_column(aggregate_column(values, opts, aggregate), opts)
|
116
120
|
end || BLANK
|
117
121
|
end.compact
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Effective
|
2
2
|
module EffectiveDatatable
|
3
3
|
module Resource
|
4
|
+
AGGREGATE_SQL_FUNCTIONS = ['ARRAY_AGG(', 'AVG(', 'COUNT(', 'MAX(', 'MIN(', 'STRING_AGG(', 'SUM(']
|
4
5
|
|
5
6
|
def admin_namespace?
|
6
7
|
controller_namespace == 'admin'
|
@@ -74,6 +75,10 @@ module Effective
|
|
74
75
|
# Anything that doesn't belong to the model or the sql table, we assume is a SELECT SUM|AVG|RANK() as fancy
|
75
76
|
opts[:sql_as_column] = true if (resource.table && resource.column(name).blank?)
|
76
77
|
end
|
78
|
+
|
79
|
+
if opts[:sql_column].present? && AGGREGATE_SQL_FUNCTIONS.any? { |str| opts[:sql_column].to_s.start_with?(str) }
|
80
|
+
opts[:sql_as_column] = true
|
81
|
+
end
|
77
82
|
end
|
78
83
|
end
|
79
84
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_datatables
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.14
|
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: 2018-01-
|
11
|
+
date: 2018-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|