eager_group 0.8.1 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88912c5696afe9332d53ac15b2365d2e2d7112391672a2cba5db62012876a138
4
- data.tar.gz: a18a2d21cd4299a68774f3dbb62556c71f3096b3ebac28bebf7a767a875fc00f
3
+ metadata.gz: 5370e57578e725513b391777f1a86e3b1d7560bc596a08b005110d3220d43325
4
+ data.tar.gz: b4987065f8781190983f2b92a84db5ea7e248f43290763ba483d52ec472cb1e8
5
5
  SHA512:
6
- metadata.gz: af269ea9b3be9f9a613f56cf14e52a7b183b6d041583f02aa88945f65150f98147ed7271523b9f8ec0d36c622f42ae257f7137e9cf842b381f11cbd7cd6e50bf
7
- data.tar.gz: 2878aaefb0b9420b13531927cd46ad47894954c2999fe81d9bf853d7f2255ae97b42df8e56c43a840b5812d71ed1f535c391ccf605fbed99f08ed0769959eab8
6
+ metadata.gz: 172290ed5e79c34139cdc35976f22e612e225e39f6b417f07f86696970f28969f058c59189e683d9ca299d5d61643dbdbf8220648889f7e4bbcb66cb30f68d7e
7
+ data.tar.gz: 91577037162ebb062b8939c02fc2aa66e4fdf1e891fb6e20ffd199d7e80879c38f20ae4fc4cc95ae32c7f16ab90377816ed42dc215dd0cd92fad9ce01f9450ea
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Next Release
2
2
 
3
+ ## 0.8.2 (09/22/2022)
4
+
5
+ * Add MIT-LICENSE
6
+
3
7
  ## 0.8.1 (10/25/2019)
4
8
 
5
9
  * Fix for `has_many :through`
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2015 - 2022 Richard Huang (flyerhzm@gmail.com)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -35,14 +35,16 @@ module EagerGroup
35
35
  if reflection.is_a?(ActiveRecord::Reflection::HasAndBelongsToManyReflection)
36
36
  ["#{reflection.join_table}.#{reflection.foreign_key}", @klass.joins(reflection.name)]
37
37
  elsif reflection.through_reflection
38
- ["#{reflection.through_reflection.name}.#{reflection.through_reflection.foreign_key}", @klass.joins(reflection.name)]
38
+ [
39
+ "#{reflection.through_reflection.name}.#{reflection.through_reflection.foreign_key}",
40
+ @klass.joins(reflection.name)
41
+ ]
39
42
  else
40
43
  [reflection.foreign_key, association_class]
41
44
  end
42
- aggregate_hash = aggregate_hash.where(foreign_key => record_ids)
43
- .where(polymophic_as_condition(reflection))
44
- .group(foreign_key)
45
- .send(definition.aggregation_function, definition.column_name)
45
+ aggregate_hash =
46
+ aggregate_hash.where(foreign_key => record_ids).where(polymophic_as_condition(reflection)).group(foreign_key)
47
+ .send(definition.aggregation_function, definition.column_name)
46
48
  if definition.need_load_object
47
49
  aggregate_objects = reflection.klass.find(aggregate_hash.values).each_with_object({}) { |o, h| h[o.id] = o }
48
50
  aggregate_hash.keys.each { |key| aggregate_hash[key] = aggregate_objects[aggregate_hash[key]] }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EagerGroup
4
- VERSION = '0.8.1'
4
+ VERSION = '0.8.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eager_group
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-25 00:00:00.000000000 Z
11
+ date: 2022-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -134,6 +134,7 @@ files:
134
134
  - ".travis.yml"
135
135
  - CHANGELOG.md
136
136
  - Gemfile
137
+ - MIT-LICENSE
137
138
  - README.md
138
139
  - Rakefile
139
140
  - benchmark.rb
@@ -149,7 +150,7 @@ homepage: https://github.com/flyerhzm/eager_group
149
150
  licenses:
150
151
  - MIT
151
152
  metadata: {}
152
- post_install_message:
153
+ post_install_message:
153
154
  rdoc_options: []
154
155
  require_paths:
155
156
  - lib
@@ -164,8 +165,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
165
  - !ruby/object:Gem::Version
165
166
  version: '0'
166
167
  requirements: []
167
- rubygems_version: 3.0.3
168
- signing_key:
168
+ rubygems_version: 3.3.7
169
+ signing_key:
169
170
  specification_version: 4
170
171
  summary: Fix n+1 aggregate sql functions
171
172
  test_files: []