eitil 1.3.6 → 1.3.10

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: fd9d35211d3f61c2a37a33f09bb080fc91801591270c9fabdb199d1abb6b3f5d
4
- data.tar.gz: 7e8d7a580c60fe77661a0bfd276c02e55936d870103a66b15f6ebb4090c914e8
3
+ metadata.gz: 29a07695204dd330dd9a5b2684ae01cc28b5346902a05a3aa5eda4404bb6cf60
4
+ data.tar.gz: 7da1b015edfaa0a64805d08032fa634707a8c77a268d32d89176789c58ef75e9
5
5
  SHA512:
6
- metadata.gz: c686f8f249fcf7d3418571d9f62adde2403e7a2d4f45a435d9c61455afdaed354332a80f88f4b7e587e9c96e690a27dc10fae81fbb61d2a452c9631525736d18
7
- data.tar.gz: 5c0c96c615314e07fe44514bd34d5298592f47a3fe4b1fc1f63555fa3acb8d72cb8db04e124259ce44873ae58def846cdd67c48e79504f5cee09251686cf04cf
6
+ metadata.gz: 6afc144ecca456786e87c64c2cddf38c3c599086d717430278d2db3c45aea1d6ef377a7d3a4d6003a91a6282222e5fb8081d9108e60f6ac114e52fa4ea782e9c
7
+ data.tar.gz: 67033e7e0544e0ae60253df87cfa7c1f3210312835ffa0e66c17456823f98c1d1cc7c85e70e1706bf9f501e08558f271471c2e7869c01e86e5f408890423118d
@@ -254,7 +254,10 @@ Calculators are generated through the columns of your model's database table. Wh
254
254
  # require "eitil_wrapper/scopes/default_scopes"
255
255
 
256
256
  # columns of datatype: array (serialized)
257
- .{column_name}_sum # returns all uniq elements in a new, single array
257
+ .{column_name}_sum # returns all uniq elements in a new, single array
258
+ .{column_name}_sum_i # sum and map to integer
259
+ .{column_name}_sum_f # sum and map to float
260
+ .{column_name}_sum_d # sum and map to decimal
258
261
 
259
262
  # columns of datatype: integer
260
263
  .{column_name}_max
@@ -18,7 +18,10 @@ module EitilWrapper
18
18
  }
19
19
 
20
20
  SharableIterableCalculators = -> (_class, column) {
21
- _class.eitil_calculator :"#{column}_sum", -> { _class.pluck(column).flatten!.uniq! }
21
+ _class.eitil_calculator :"#{column}_sum", -> { _class.pluck(column)&.flatten!&.uniq! || [] }
22
+ _class.eitil_calculator :"#{column}_sum_i", -> { _class.pluck(column)&.flatten!&.uniq!&.map(&:to_i) || [] }
23
+ _class.eitil_calculator :"#{column}_sum_f", -> { _class.pluck(column)&.flatten!&.uniq!&.map(&:to_f) || [] }
24
+ _class.eitil_calculator :"#{column}_sum_d", -> { _class.pluck(column)&.flatten!&.uniq!&.map(&:to_d) || [] }
22
25
  }
23
26
 
24
27
  def inherited(subclass)
@@ -36,7 +39,7 @@ module EitilWrapper
36
39
  subclass.use_eitil_calculators
37
40
 
38
41
  rescue => e
39
- puts "default calculators failed for #{subclass} because of #{e.class} and '#{e.to_s.split(' ').first}'"
42
+ puts "default calculators failed for class '#{subclass}' with expected table '#{subclass.table_name}' because of #{e.class} and '#{e.to_s.split(' ').first}'"
40
43
  end
41
44
 
42
45
  def use_eitil_calculators
@@ -99,4 +102,3 @@ module EitilWrapper
99
102
  end
100
103
  end
101
104
  end
102
-
@@ -43,7 +43,7 @@ module EitilWrapper
43
43
  subclass.use_eitil_scopes
44
44
 
45
45
  rescue => e
46
- puts "default scopes failed for #{subclass} because of #{e.class} and '#{e.to_s.split(' ').first}'"
46
+ puts "default scopes failed for class '#{subclass}' with expected table '#{subclass.table_name}' because of #{e.class} and '#{e.to_s.split(' ').first}'"
47
47
  end
48
48
 
49
49
  def use_eitil_scopes
@@ -56,7 +56,6 @@ module EitilWrapper
56
56
  end
57
57
 
58
58
  def columns_of_type(data_type)
59
- binding.pry if $pry
60
59
  columns_hash.select { |column,v| v.sql_type_metadata.type == data_type }
61
60
  end
62
61
 
@@ -1,3 +1,4 @@
1
+
1
2
  # require "eitil_wrapper/records/default_sorts"
2
3
 
3
4
  # require "eitil_wrapper/railtie" to run the dynamic dispatch as an init hook during boot
@@ -35,7 +36,7 @@ module EitilWrapper
35
36
  subclass.use_eitil_sorts
36
37
 
37
38
  rescue => e
38
- puts "default sorts failed for #{subclass} because of #{e.class} and '#{e.to_s.split(' ').first}'"
39
+ puts "default sorts failed for class '#{subclass}' with expected table '#{subclass.table_name}' because of #{e.class} and '#{e.to_s.split(' ').first}'"
39
40
  end
40
41
 
41
42
  def use_eitil_sorts
data/lib/eitil/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Eitil
2
2
 
3
- VERSION = '1.3.6'
3
+ VERSION = '1.3.10'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eitil
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.6
4
+ version: 1.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jurriaan Schrofer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-05 00:00:00.000000000 Z
11
+ date: 2021-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -207,7 +207,6 @@ files:
207
207
  - eitil_core/lib/eitil_core/hash/auto_dig.rb
208
208
  - eitil_core/lib/eitil_core/hash/transform_string_values.rb
209
209
  - eitil_core/lib/eitil_core/kernel.rb
210
- - eitil_core/lib/eitil_core/kernel/always_require_relative.rb
211
210
  - eitil_core/lib/eitil_core/kernel/loadquire.rb
212
211
  - eitil_core/lib/eitil_core/kernel/loadquire_bang.rb
213
212
  - eitil_core/lib/eitil_core/lookups.rb
@@ -1,21 +0,0 @@
1
-
2
- # require "eitil_core/kernel/always_require_relative"
3
-
4
- Kernel.module_eval do
5
-
6
- def always_require_relative(current_path, relative_path, extension = '.rb')
7
-
8
- unless Object.const_defined?('Rails')
9
- return require_relative(path)
10
- end
11
-
12
- absolute_path = File.expand_path(relative_path, current_path).concat(extension)
13
-
14
- if Rails.env.development?
15
- load(absolute_path)
16
- else
17
- require(absolute_path)
18
- end
19
- end
20
-
21
- end