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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63bda6ce4591fc9695b29db8e53aee19966e3630e9c8b059c686678043f20938
4
- data.tar.gz: e780a77254b8c8b1cc23ecc732146d581def733fef8669fc3a0419e32fabf5df
3
+ metadata.gz: bd8ff0998a757ff875a17baad2fcb148ace4239da0781e1b7fbdd4c6367cef2c
4
+ data.tar.gz: 316ee68af897e1b866b79b28d3f0889f116982a48b94a123cde5170ac851b4e1
5
5
  SHA512:
6
- metadata.gz: 89718eab7d4398d77f9d19de7e7160e52feebfc295e03a7c05a113a87159e5e3640b599d681559c53e749bf68bdcee477effff6b4b605c4dcf317da6c09d2cdd
7
- data.tar.gz: 4d999fe0374b28e826edbb6f6eca9fc9f8ab9ae7aff1056aa88757079e00847f8361862108ba65227f530b72fa918e849dd3bbfe1b337156a685dd4f26b706d8
6
+ metadata.gz: 73f92eed3389912530e9ff393e761bbc6e86a84e1c6beff4428de03f295a2fe91f2b230d25d8a3d0b783761b099dca43b4bc62ea05538a469c925eae5c9044d2
7
+ data.tar.gz: b1217306b02aa8e40b78cea0d0d31dca84621c4b676e79a638bf8644891e301a3d850e2f645d9c0b745724c4a03c0837936cbe1776e9794a89e4e73580589256
@@ -1,3 +1,9 @@
1
+ ## 0.6.1 (2020-08-29)
2
+
3
+ ### Misc
4
+
5
+ * Add `date` as an option for datetime drills - *germanotm*
6
+
1
7
  ## 0.6.0 (2020-08-21)
2
8
 
3
9
  ### Features
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
- "DATE_TRUNC('#{@datetime_drill}', #{column})"
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveReporting
4
- VERSION = '0.6.0'
4
+ VERSION = '0.6.1'
5
5
  end
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.0
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-21 00:00:00.000000000 Z
11
+ date: 2020-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord