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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -0
- data/lib/rollup/aggregator.rb +9 -1
- data/lib/rollup/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: e0ec70ee09b71a3a86cb895a6ebb08da1a10fcce3387a713e48f459bd6b3b1b2
|
4
|
+
data.tar.gz: df6c597429334dac4f29d2da102a01818d8bad8bf7f42b3e93801b11cee6d2bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64b0b3d9f3f81292de5753c2514bbe6d976fdcd2a4636c3563c1e8ba6e45d0f4b44a00b5dbf239dbb811decbb28695cade962f304edebc19518c383fbe04fac0
|
7
|
+
data.tar.gz: 6a096a113be0c7a1a1ab543f43110c1894d418f53163cd3c632baa1a53e311ffd3947a7ccddecc0b7333257cb35a874d8cd1192289e83e1e03e619a3b7c0cfaa
|
data/CHANGELOG.md
CHANGED
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:
|
data/lib/rollup/aggregator.rb
CHANGED
@@ -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
|
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..
|
data/lib/rollup/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2020-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|