active_reporter 0.7.1 → 0.7.3

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: a17f440927f29a1dac9ad70f949fc92d0f57c72d8ccac27a4b27c0e737f86b43
4
- data.tar.gz: 7cede09d4c1e903437b18b945e2ad3ea283ac6cdf886a21cd938124d1c39bcbf
3
+ metadata.gz: bd621943a7508651f94f389d81cb897e5dc7eae2d10f9dd2f261f29533bdc588
4
+ data.tar.gz: da5082a988b18ff4f821f4e96c184f0e0bfae72bcc0474de2b6d110481bd428b
5
5
  SHA512:
6
- metadata.gz: '0851b545beec8ac54b01d5148e8a04b0b39ef94e26f6ce8ca946ab6243bb2bb2f96da10d5d057748142b46d837310397443a27ce1c3b1eaed37faa8a5026be04'
7
- data.tar.gz: a511a0301caeff962a234cf472b1557cda47381e04091af704816fcd3951fe4d4bfba4e531f30aeeb6b945ef9b5e038d277ab2ae30a5f915ede53964da09549a
6
+ metadata.gz: 561cc794d2820d10b6f62abb3a0da32f86a0dad34e007c6e5dede83ef30f5d6433cea1d308e44561a24fa3a30360859ccd7b9efb87a47078d9afc541654f40ef
7
+ data.tar.gz: d64d12a3fc5df2f0af7505f49f1987b963a2d7ed3909128e5af5cc7b42acf9c8e9c0d084924d9ae7cbe4c6941eafabf79730d054fe3722190d7c190bcc7e309e
@@ -13,6 +13,22 @@ module ActiveReporter
13
13
  enum_values.keys.tap { |values| values.unshift(nil) unless values.include?(nil) }.uniq
14
14
  end
15
15
 
16
+ def filter(relation)
17
+ values = if Rails.gem_version >= Gem::Version.new("7")
18
+ filter_values.map { |value| enum_values[value] }.uniq
19
+ else
20
+ filter_values
21
+ end
22
+ query = case values
23
+ when [] then "1=0"
24
+ when [nil] then "#{expression} IS NULL"
25
+ else
26
+ in_values = "#{expression} IN (?)"
27
+ values.include?(nil) ? "#{expression} IS NULL OR #{in_values}" : in_values
28
+ end
29
+ relation.where(query, values.compact)
30
+ end
31
+
16
32
  private
17
33
 
18
34
  def enum_values
@@ -31,7 +47,7 @@ module ActiveReporter
31
47
  end
32
48
 
33
49
  def enum?
34
- true # Hash(model&.defined_enums).include?(attribute.to_s)
50
+ Hash(model&.defined_enums).include?(attribute.to_s)
35
51
  end
36
52
  end
37
53
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveReporter
2
- VERSION = "0.7.1"
2
+ VERSION = "0.7.3"
3
3
  end
@@ -25,16 +25,16 @@ Rails.application.configure do
25
25
  # Debug mode disables concatenation and preprocessing of assets.
26
26
  # This option may cause significant delays in view rendering with a large
27
27
  # number of complex assets.
28
- config.assets.debug = true
28
+ # config.assets.debug = true
29
29
 
30
30
  # Asset digests allow you to set far-future HTTP expiration dates on all assets,
31
31
  # yet still be able to expire them through the digest params.
32
- config.assets.digest = true
32
+ # config.assets.digest = true
33
33
 
34
34
  # Adds additional error checking when serving assets at runtime.
35
35
  # Checks for improperly declared sprockets dependencies.
36
36
  # Raises helpful error messages.
37
- config.assets.raise_runtime_errors = true
37
+ # config.assets.raise_runtime_errors = true
38
38
 
39
39
  # Raises error for missing translations
40
40
  # config.action_view.raise_on_missing_translations = true
@@ -25,15 +25,15 @@ Rails.application.configure do
25
25
  config.serve_static_files = ENV["RAILS_SERVE_STATIC_FILES"].present?
26
26
 
27
27
  # Compress JavaScripts and CSS.
28
- config.assets.js_compressor = :uglifier
28
+ # config.assets.js_compressor = :uglifier
29
29
  # config.assets.css_compressor = :sass
30
30
 
31
31
  # Do not fallback to assets pipeline if a precompiled asset is missed.
32
- config.assets.compile = false
32
+ # config.assets.compile = false
33
33
 
34
34
  # Asset digests allow you to set far-future HTTP expiration dates on all assets,
35
35
  # yet still be able to expire them through the digest params.
36
- config.assets.digest = true
36
+ # config.assets.digest = true
37
37
 
38
38
  # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
39
39
 
@@ -1,7 +1,7 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
3
  # Version of your assets, change this if you want to expire all your assets.
4
- Rails.application.config.assets.version = "1.0"
4
+ # Rails.application.config.assets.version = "1.0"
5
5
 
6
6
  # Add additional assets to the asset load path
7
7
  # Rails.application.config.assets.paths << Emoji.images_path
File without changes