rollups 0.2.0 → 0.3.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: 5bc765589c1bb3ac755335e36a1a283ef4aeac8ac54a6bc102d3358c57768628
4
- data.tar.gz: 0eab24b5cd948823ab190674618fec7ce0935b91d740384854e0474b931d9318
3
+ metadata.gz: b0fa306f943a2bad69a6515e6735374dd1ee4e927e6bd01dfb3b5dc33cd59aa0
4
+ data.tar.gz: 8ae83c58992563b5c7b7474c29df74ef45d5450eac7ce4be4280e7ff36712435
5
5
  SHA512:
6
- metadata.gz: 8a64dd7d050f06d49a5d8261b09b0437faf7a579e086b154903daf86de86ad799a1b97c98d44149b0e0fb20e4531a9d435b787adccefff7b89afb91f4cc44af3
7
- data.tar.gz: 60ac29b15fb518bfaad4026ca02d55a926a829f1229f758993a07cace6117030247211750fb1bc33deb9547e55e406ab81e1a06f2ecc3f9208d626d62744aa3c
6
+ metadata.gz: d59d9c091e78af3808e494ff89d9dc0432528a8b69b9c413111a994e7d1fef2718797e23090c885307be2932ea021834fcb25298b173477d9fcad5696148a537
7
+ data.tar.gz: ed3bae975a14d4790044097200984c8dd48c28a50023a0e6326c1dd709c117f35f399a8491125fb9eb9c5cf432519e370fc4cdc5c40ec5b4c5da82e0fdf47290
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.3.1 (2023-09-20)
2
+
3
+ - Added support for Trilogy
4
+
5
+ ## 0.3.0 (2023-07-02)
6
+
7
+ - Dropped support for Ruby < 3 and Active Record < 6.1
8
+
1
9
  ## 0.2.0 (2022-04-05)
2
10
 
3
11
  - Added `range` option
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020-2022 Andrew Kane
3
+ Copyright (c) 2020-2023 Andrew Kane
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -219,6 +219,12 @@ If a series has dimensions, they must match exactly as well
219
219
  Rollup.series("Orders by platform and channel", dimensions: {platform: "Web", channel: "Search"})
220
220
  ```
221
221
 
222
+ Get a specific time range
223
+
224
+ ```ruby
225
+ Rollup.where(time: Date.current.all_year).series("New Users")
226
+ ```
227
+
222
228
  ### Multiple Series
223
229
 
224
230
  *PostgreSQL only*
@@ -241,6 +247,12 @@ Filter by dimensions
241
247
  Rollup.where_dimensions(platform: "Web").multi_series("Orders by platform and channel")
242
248
  ```
243
249
 
250
+ Get a specific time range
251
+
252
+ ```ruby
253
+ Rollup.where(time: Date.current.all_year).multi_series("Orders by platform")
254
+ ```
255
+
244
256
  ### Raw Data
245
257
 
246
258
  Uses the `Rollup` model to query the data directly
@@ -25,10 +25,6 @@ class RollupsGenerator < Rails::Generators::Base
25
25
  end
26
26
 
27
27
  def adapter
28
- if ActiveRecord::VERSION::STRING.to_f >= 6.1
29
- ActiveRecord::Base.connection_db_config.adapter.to_s
30
- else
31
- ActiveRecord::Base.connection_config[:adapter].to_s
32
- end
28
+ ActiveRecord::Base.connection_db_config.adapter.to_s
33
29
  end
34
30
  end
@@ -183,16 +183,8 @@ class Rollup
183
183
  conflict_target = [:name, :interval, :time]
184
184
  conflict_target << :dimensions if Utils.dimensions_supported?
185
185
 
186
- if ActiveRecord::VERSION::MAJOR >= 6
187
- options = Utils.mysql? ? {} : {unique_by: conflict_target}
188
- Rollup.unscoped.upsert_all(records, **options)
189
- else
190
- update = Utils.mysql? ? [:value] : {columns: [:value], conflict_target: conflict_target}
191
- Rollup.unscoped.import(records,
192
- on_duplicate_key_update: update,
193
- validate: false
194
- )
195
- end
186
+ options = Utils.mysql? ? {} : {unique_by: conflict_target}
187
+ Rollup.unscoped.upsert_all(records, **options)
196
188
  end
197
189
  end
198
190
  end
data/lib/rollup/utils.rb CHANGED
@@ -41,7 +41,7 @@ class Rollup
41
41
  end
42
42
 
43
43
  def mysql?
44
- adapter_name =~ /mysql/i
44
+ adapter_name =~ /mysql|trilogy/i
45
45
  end
46
46
 
47
47
  def sqlite?
@@ -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.2.0"
4
+ VERSION = "0.3.1"
5
5
  end
data/lib/rollups.rb CHANGED
@@ -4,14 +4,14 @@ require "groupdate"
4
4
 
5
5
  ActiveSupport.on_load(:active_record) do
6
6
  # must come first
7
- require "rollup"
7
+ require_relative "rollup"
8
8
 
9
- require "rollup/model"
9
+ require_relative "rollup/model"
10
10
  extend Rollup::Model
11
11
  Rollup.rollup_column = :time
12
12
 
13
13
  # modules
14
- require "rollup/aggregator"
15
- require "rollup/utils"
16
- require "rollup/version"
14
+ require_relative "rollup/aggregator"
15
+ require_relative "rollup/utils"
16
+ require_relative "rollup/version"
17
17
  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.2.0
4
+ version: 0.3.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: 2022-04-05 00:00:00.000000000 Z
11
+ date: 2023-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.2'
19
+ version: '6.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '5.2'
26
+ version: '6.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: groupdate
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -68,14 +68,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - ">="
70
70
  - !ruby/object:Gem::Version
71
- version: '2.6'
71
+ version: '3'
72
72
  required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
- rubygems_version: 3.3.7
78
+ rubygems_version: 3.4.10
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: Rollup time-series data in Rails