rollups 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac85a23af0477ab8ce7abed983995b06a935f82c2836fc0a63ff1fe4b150b9d7
4
- data.tar.gz: bb60e3c7c87e22e68a4ba94652e011031292ce879d60824f745d7f808055684c
3
+ metadata.gz: e0ec70ee09b71a3a86cb895a6ebb08da1a10fcce3387a713e48f459bd6b3b1b2
4
+ data.tar.gz: df6c597429334dac4f29d2da102a01818d8bad8bf7f42b3e93801b11cee6d2bf
5
5
  SHA512:
6
- metadata.gz: abee36f374c42202b8a13919ff863aef511af7c28258eb5f657b0b00de4d8f9d329d53d1f58768377372eae428c09b7f223fbcdeb2b7a43a87339fbe3d9f3e9e
7
- data.tar.gz: 452951f5d6a8fda80288650b7061e0e17ab9bfd76a2638a7f529b4919ec2933fb725b07e6f85392665fd4e44b69790eed1d69b88341122aa8338640e4b45c868
6
+ metadata.gz: 64b0b3d9f3f81292de5753c2514bbe6d976fdcd2a4636c3563c1e8ba6e45d0f4b44a00b5dbf239dbb811decbb28695cade962f304edebc19518c383fbe04fac0
7
+ data.tar.gz: 6a096a113be0c7a1a1ab543f43110c1894d418f53163cd3c632baa1a53e311ffd3947a7ccddecc0b7333257cb35a874d8cd1192289e83e1e03e619a3b7c0cfaa
@@ -1,3 +1,7 @@
1
+ ## 0.1.1 (2020-09-09)
2
+
3
+ - Fixed results for earlier versions of MySQL
4
+
1
5
  ## 0.1.0 (2020-09-07)
2
6
 
3
7
  - First release
data/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  Works great with [Ahoy](https://github.com/ankane/ahoy) and [Searchjoy](https://github.com/ankane/searchjoy)
6
6
 
7
+ [![Build Status](https://travis-ci.org/ankane/rollup.svg?branch=master)](https://travis-ci.org/ankane/rollup)
8
+
7
9
  ## Installation
8
10
 
9
11
  Add this line to your application’s Gemfile:
@@ -35,12 +35,14 @@ class Rollup
35
35
  def perform_group(name, column:, interval:, time_zone:, current:, last:, clear:)
36
36
  raise ArgumentError, "Cannot use last and clear together" if last && clear
37
37
 
38
+ time_zone ||= Rollup.time_zone
39
+
38
40
  gd_options = {
39
41
  current: current
40
42
  }
41
43
 
42
44
  # make sure Groupdate global options aren't applied
43
- gd_options[:time_zone] = time_zone || Rollup.time_zone
45
+ gd_options[:time_zone] = time_zone
44
46
  gd_options[:week_start] = Rollup.week_start if interval.to_s == "week"
45
47
  gd_options[:day_start] = 0 if Utils.date_interval?(interval)
46
48
 
@@ -51,6 +53,12 @@ class Rollup
51
53
  # if rollups, recompute last interval
52
54
  max_time = Rollup.where(name: name, interval: interval).maximum(Utils.time_sql(interval))
53
55
  if max_time
56
+ # for MySQL on Ubuntu 18.04 (and likely other platforms)
57
+ if max_time.is_a?(String)
58
+ utc = ActiveSupport::TimeZone["Etc/UTC"]
59
+ max_time = Utils.date_interval?(interval) ? max_time.to_date : utc.parse(max_time).in_time_zone(time_zone)
60
+ end
61
+
54
62
  # aligns perfectly if time zone doesn't change
55
63
  # if time zone does change, there are other problems besides this
56
64
  gd_options[:range] = max_time..
@@ -1,5 +1,5 @@
1
1
  class Rollup
2
2
  # not used in gemspec to avoid superclass mismatch
3
3
  # be sure to update there as well
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rollups
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-07 00:00:00.000000000 Z
11
+ date: 2020-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport