groupdate 4.1.1 → 4.1.2

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: 3bdc7848103a019e737a44e522ae42dcdb521c2ae136d9a52d1bafba795127d4
4
- data.tar.gz: fccb9acee92d478d605ac8022e75173bccd4825ad5118a32d5aaaf3ef34c5349
3
+ metadata.gz: 28ba8881c2af7869f774eceebed739e851e81d7d28b53473762260e7c4297134
4
+ data.tar.gz: e0031f94b52b53255bdbe01c0f72d5c7abcb20d94b02d81bf9e31344a957919a
5
5
  SHA512:
6
- metadata.gz: 9ad47038f6ec8193721ebc56509c1bda0feff36ecb65a7c08e63859592d55de1387e3e0fb907ac55c16329bf8c275265492ab45b6d7217643203d1c94419d324
7
- data.tar.gz: c53eb19f798e162eef984cf6dc32b8be7b3b9e40008dfed445653fae618ae0d1db65e1420db6896f254f5c48daf49f3e97e163c5ed41958e75ad98c7d77590a0
6
+ metadata.gz: cb863625ed13dea87c18b31bf897f0e6d6c00bb02b3c41aaf08a11221cc52a8cbfea5cb4f8fe991d33552b0f9294c9c2c04bfb1c220bdcfb8688dbacc848ceed
7
+ data.tar.gz: 805c5290d0652b2f82c3426fb253dc962bc9c2e4903b3edb1aa2451dc252f0c94bbc7737d3c1b8ddd429c5844ca99c8c01b1e872f1efd4980a747eb4cd2c4294
@@ -1,3 +1,9 @@
1
+ ## 4.1.2
2
+
3
+ - Fixed error with empty data and `current: false`
4
+ - Fixed error in time zone check for Rails < 5.2
5
+ - Prevent infinite loop with endless ranges
6
+
1
7
  ## 4.1.1
2
8
 
3
9
  - Made column resolution consistent with `group`
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013-2018 Andrew Kane
1
+ Copyright (c) 2013-2019 Andrew Kane
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -17,7 +17,17 @@ Supports PostgreSQL, MySQL, and Redshift, plus arrays and hashes (and limited su
17
17
 
18
18
  [![Build Status](https://travis-ci.org/ankane/groupdate.svg?branch=master)](https://travis-ci.org/ankane/groupdate)
19
19
 
20
- ## Get Started
20
+ ## Installation
21
+
22
+ Add this line to your application’s Gemfile:
23
+
24
+ ```ruby
25
+ gem 'groupdate'
26
+ ```
27
+
28
+ For MySQL and SQLite, also follow [these instructions](#additional-instructions).
29
+
30
+ ## Getting Started
21
31
 
22
32
  ```ruby
23
33
  User.group_by_day(:created_at).count
@@ -221,15 +231,9 @@ Count
221
231
  Hash[ users.group_by_day { |u| u.created_at }.map { |k, v| [k, v.size] } ]
222
232
  ```
223
233
 
224
- ## Installation
225
-
226
- Add this line to your application’s Gemfile:
227
-
228
- ```ruby
229
- gem 'groupdate'
230
- ```
234
+ ## Additional Instructions
231
235
 
232
- #### For MySQL
236
+ ### For MySQL
233
237
 
234
238
  [Time zone support](https://dev.mysql.com/doc/refman/5.7/en/time-zone-support.html) must be installed on the server.
235
239
 
@@ -247,7 +251,7 @@ SELECT CONVERT_TZ(NOW(), '+00:00', 'Pacific/Honolulu');
247
251
 
248
252
  It should return the time instead of `NULL`.
249
253
 
250
- #### For SQLite
254
+ ### For SQLite
251
255
 
252
256
  Groupdate has limited support for SQLite.
253
257
 
@@ -301,3 +305,5 @@ Everyone is encouraged to help improve this project. Here are a few ways you can
301
305
  - Fix bugs and [submit pull requests](https://github.com/ankane/groupdate/pulls)
302
306
  - Write, clarify, or fix documentation
303
307
  - Suggest or add new features
308
+
309
+ To get started with development and testing, check out the [Contributing Guide](CONTRIBUTING.md).
@@ -13,6 +13,7 @@ module Groupdate
13
13
 
14
14
  raise Groupdate::Error, "Unrecognized time zone" unless time_zone
15
15
  raise Groupdate::Error, "Unrecognized :week_start option" if period == :week && !week_start
16
+ raise Groupdate::Error, "Cannot use endless range for :range option" if options[:range].is_a?(Range) && !options[:range].end
16
17
  end
17
18
 
18
19
  def time_zone
@@ -110,7 +111,8 @@ module Groupdate
110
111
 
111
112
  def time_zone_support?(relation)
112
113
  if relation.connection.adapter_name =~ /mysql/i
113
- sql = relation.send(:sanitize_sql_array, ["SELECT CONVERT_TZ(NOW(), '+00:00', ?)", time_zone.tzinfo.name])
114
+ # need to call klass for Rails < 5.2
115
+ sql = relation.klass.send(:sanitize_sql_array, ["SELECT CONVERT_TZ(NOW(), '+00:00', ?)", time_zone.tzinfo.name])
114
116
  !relation.connection.select_all(sql).first.values.first.nil?
115
117
  else
116
118
  true
@@ -158,7 +158,7 @@ module Groupdate
158
158
  end
159
159
 
160
160
  tr = sorted_keys.first..sorted_keys.last
161
- if options[:current] == false && round_time(now) >= tr.last
161
+ if options[:current] == false && sorted_keys.any? && round_time(now) >= tr.last
162
162
  tr = tr.first...round_time(now)
163
163
  end
164
164
  tr
@@ -1,3 +1,3 @@
1
1
  module Groupdate
2
- VERSION = "4.1.1"
2
+ VERSION = "4.1.2"
3
3
  end
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.1
4
+ version: 4.1.2
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-12-11 00:00:00.000000000 Z
11
+ date: 2019-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -112,16 +112,16 @@ dependencies:
112
112
  name: sqlite3
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 1.3.0
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: 1.3.0
125
125
  description:
126
126
  email: andrew@chartkick.com
127
127
  executables: []
@@ -160,8 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  - !ruby/object:Gem::Version
161
161
  version: '0'
162
162
  requirements: []
163
- rubyforge_project:
164
- rubygems_version: 2.7.6
163
+ rubygems_version: 3.0.3
165
164
  signing_key:
166
165
  specification_version: 4
167
166
  summary: The simplest way to group temporal data