active_reporting 0.6.0 → 0.6.1
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/CHANGELOG.md +6 -0
- data/README.md +1 -0
- data/lib/active_reporting/reporting_dimension.rb +9 -2
- data/lib/active_reporting/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: bd8ff0998a757ff875a17baad2fcb148ace4239da0781e1b7fbdd4c6367cef2c
|
4
|
+
data.tar.gz: 316ee68af897e1b866b79b28d3f0889f116982a48b94a123cde5170ac851b4e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73f92eed3389912530e9ff393e761bbc6e86a84e1c6beff4428de03f295a2fe91f2b230d25d8a3d0b783761b099dca43b4bc62ea05538a469c925eae5c9044d2
|
7
|
+
data.tar.gz: b1217306b02aa8e40b78cea0d0d31dca84621c4b676e79a638bf8644891e301a3d850e2f645d9c0b745724c4a03c0837936cbe1776e9794a89e4e73580589256
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -250,6 +250,7 @@ When creating a metric, ActiveReporting will recognize the following datetime hi
|
|
250
250
|
- decade
|
251
251
|
- century
|
252
252
|
- millennium
|
253
|
+
- date
|
253
254
|
|
254
255
|
Under the hood Active Reporting uses specific database functions to manipulate datetime columns. Postgres provides a way to group by `datetime` column data on the fly using the [`date_trunc` function](https://www.postgresql.org/docs/8.1/static/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC). On Mysql this can be done using [Date and Time Functions](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html).
|
255
256
|
|
@@ -8,7 +8,7 @@ module ActiveReporting
|
|
8
8
|
# Values for the Postgres `date_trunc` method.
|
9
9
|
# See https://www.postgresql.org/docs/10/static/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC
|
10
10
|
DATETIME_HIERARCHIES = %i[microseconds milliseconds second minute hour day week month quarter year decade
|
11
|
-
century millennium].freeze
|
11
|
+
century millennium date].freeze
|
12
12
|
JOIN_METHODS = { joins: :joins, left_outer_joins: :left_outer_joins }.freeze
|
13
13
|
attr_reader :join_method, :label
|
14
14
|
|
@@ -188,7 +188,12 @@ module ActiveReporting
|
|
188
188
|
end
|
189
189
|
|
190
190
|
def datetime_drill_postgress(column)
|
191
|
-
|
191
|
+
case @datetime_drill.to_sym
|
192
|
+
when :date
|
193
|
+
"DATE('#{column}')"
|
194
|
+
else
|
195
|
+
"DATE_TRUNC('#{@datetime_drill}', #{column})"
|
196
|
+
end
|
192
197
|
end
|
193
198
|
|
194
199
|
def datetime_drill_mysql(column)
|
@@ -219,6 +224,8 @@ module ActiveReporting
|
|
219
224
|
"YEAR(#{column}) DIV 100"
|
220
225
|
when :millennium
|
221
226
|
"YEAR(#{column}) DIV 1000"
|
227
|
+
when :date
|
228
|
+
"DATE(#{column})"
|
222
229
|
end
|
223
230
|
end
|
224
231
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_reporting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Drake
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|