groupdate 4.1.0 → 4.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 +6 -1
- data/README.md +1 -1
- data/lib/groupdate/relation_builder.rb +10 -1
- data/lib/groupdate/series_builder.rb +1 -1
- data/lib/groupdate/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bdc7848103a019e737a44e522ae42dcdb521c2ae136d9a52d1bafba795127d4
|
4
|
+
data.tar.gz: fccb9acee92d478d605ac8022e75173bccd4825ad5118a32d5aaaf3ef34c5349
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ad47038f6ec8193721ebc56509c1bda0feff36ecb65a7c08e63859592d55de1387e3e0fb907ac55c16329bf8c275265492ab45b6d7217643203d1c94419d324
|
7
|
+
data.tar.gz: c53eb19f798e162eef984cf6dc32b8be7b3b9e40008dfed445653fae618ae0d1db65e1420db6896f254f5c48daf49f3e97e163c5ed41958e75ad98c7d77590a0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 4.1.1
|
2
|
+
|
3
|
+
- Made column resolution consistent with `group`
|
4
|
+
- Added support for `alias_attribute`
|
5
|
+
|
1
6
|
## 4.1.0
|
2
7
|
|
3
8
|
- Many performance improvements
|
@@ -8,7 +13,7 @@
|
|
8
13
|
## 4.0.2
|
9
14
|
|
10
15
|
- Make `current` option work without `last`
|
11
|
-
- Fixed default value for `maximum`, `minimum`, and `average`
|
16
|
+
- Fixed default value for `maximum`, `minimum`, and `average` (periods with no results now return `nil` instead of `0`, pass `default_value: 0` for previous behavior)
|
12
17
|
|
13
18
|
## 4.0.1
|
14
19
|
|
data/README.md
CHANGED
@@ -48,7 +48,7 @@ and
|
|
48
48
|
- day_of_month
|
49
49
|
- month_of_year
|
50
50
|
|
51
|
-
Use it anywhere you can use `group`. Works with `count`, `sum`, `minimum`, `maximum`, `average`,
|
51
|
+
Use it anywhere you can use `group`. Works with `count`, `sum`, `minimum`, `maximum`, and `average`. For `median`, check out [ActiveMedian](https://github.com/ankane/active_median). For other aggregate functions, including multiple together, check out [CalculateAll](https://github.com/codesnik/calculate-all).
|
52
52
|
|
53
53
|
### Time Zones
|
54
54
|
|
@@ -4,7 +4,7 @@ module Groupdate
|
|
4
4
|
|
5
5
|
def initialize(relation, column:, period:, time_zone:, time_range:, week_start:, day_start:)
|
6
6
|
@relation = relation
|
7
|
-
@column = column
|
7
|
+
@column = resolve_column(relation, column)
|
8
8
|
@period = period
|
9
9
|
@time_zone = time_zone
|
10
10
|
@time_range = time_range
|
@@ -173,5 +173,14 @@ module Groupdate
|
|
173
173
|
["#{column} IS NOT NULL"]
|
174
174
|
end
|
175
175
|
end
|
176
|
+
|
177
|
+
# resolves eagerly
|
178
|
+
# need to convert both where_clause (easy)
|
179
|
+
# and group_clause (not easy) if want to avoid this
|
180
|
+
def resolve_column(relation, column)
|
181
|
+
node = relation.send(:relation).send(:arel_columns, [column]).first
|
182
|
+
node = Arel::Nodes::SqlLiteral.new(node) if node.is_a?(String)
|
183
|
+
relation.connection.visitor.accept(node, Arel::Collectors::SQLString.new).value
|
184
|
+
end
|
176
185
|
end
|
177
186
|
end
|
@@ -176,7 +176,7 @@ module Groupdate
|
|
176
176
|
last_step = series.last
|
177
177
|
loop do
|
178
178
|
next_step = last_step + step
|
179
|
-
next_step = round_time(next_step) if next_step.hour !=
|
179
|
+
next_step = round_time(next_step) if next_step.hour != day_start # add condition to speed up
|
180
180
|
break unless time_range.cover?(next_step)
|
181
181
|
|
182
182
|
if next_step == last_step
|
data/lib/groupdate/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groupdate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.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: 2018-11
|
11
|
+
date: 2018-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -161,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
161
|
version: '0'
|
162
162
|
requirements: []
|
163
163
|
rubyforge_project:
|
164
|
-
rubygems_version: 2.7.
|
164
|
+
rubygems_version: 2.7.6
|
165
165
|
signing_key:
|
166
166
|
specification_version: 4
|
167
167
|
summary: The simplest way to group temporal data
|