effective_resources 2.19.11 → 2.19.12

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: 0fc5b41757668d88d0ae83b6a52f332ad18e645658909bf80c69b3fa47dd3b98
4
- data.tar.gz: 55830a5d7d49dfea77885a2741dd06f335f6dbbc6cf80b86beccc39b720e9535
3
+ metadata.gz: 1be94e8ced0d5bd8c7e28d738435ca83614afe8caa6b7360fd760ec6a14b217c
4
+ data.tar.gz: 51c5577ee73d2c4206929d020f32ec29ac0488a50f125a264522a267610ba3b8
5
5
  SHA512:
6
- metadata.gz: ef99fd38dede8d87305ef660a87cc95ea64b9307812d80b7dd14cd2f2b4da7dd5e8532ac2ddf9e39521cdd637ab5027a4c8534bb1a8bc5ee134576a148d16f24
7
- data.tar.gz: 7527c0b651f37c1046299286e8165bb4a3670e879227b4be7ce83c6fb3c742eab7876f2c54138f1cd25bad281b13a69d2da5085c3b629d38f3a7d34e5fb07dd7
6
+ metadata.gz: e63dac719bd2e57f8d05c5c83d9c1c4ba7170e956097c6d843e65d10bfb1e9e44613bc5b40407439e68dd9c288f5a6ea7c31d86e103251993d0de3d6b669e721
7
+ data.tar.gz: 00f602d5582cf3e6d3cb1313bce80912a5937412ea513683b94e979b8561f5256433875d4d0838f5a7060257c3e8d90cc56fe143a6d5f639bc9e295a4de5e5a7
@@ -83,7 +83,7 @@ module Effective
83
83
  date = if digits.first.length == 4 # 2017-01-10
84
84
  (Time.zone.local(*digits) rescue nil)
85
85
  else # 01/10/2016
86
- year = digits.find { |d| d.length == 4}
86
+ year = digits.find { |d| d.length == 4 }
87
87
  digits = [year] + (digits - [year])
88
88
  (Time.zone.local(*digits) rescue nil)
89
89
  end
@@ -299,7 +299,7 @@ module Effective
299
299
  .where(ActiveStorage::Blob.arel_table[:filename].matches("%#{term}%"))
300
300
 
301
301
  when :date, :datetime
302
- if value.kind_of?(String)
302
+ if value.kind_of?(String) && term.respond_to?(:strftime)
303
303
  end_at = (
304
304
  case (value.to_s.scan(/(\d+)/).flatten).length
305
305
  when 1 ; term.end_of_year # Year
@@ -323,8 +323,9 @@ module Effective
323
323
  else
324
324
  relation.where("#{sql_column} >= ? AND #{sql_column} <= ?", value.beginning_of_day, value.end_of_day)
325
325
  end
326
+ elsif term.respond_to?(:strftime) == false && operation.to_s.include?('days_ago') == false
327
+ relation.none # It's an invalid entered date
326
328
  end
327
-
328
329
  when :effective_obfuscation
329
330
  term = Attribute.new(as, klass: (associated(name).try(:klass) || klass)).parse(value, name: name)
330
331
  relation.where(attribute.eq((value == term ? 0 : term)))
@@ -338,9 +339,13 @@ module Effective
338
339
  relation.with_role(term)
339
340
 
340
341
  when :time
341
- timed = relation.where("EXTRACT(hour from #{sql_column}) = ?", term.utc.hour)
342
- timed = timed.where("EXTRACT(minute from #{sql_column}) = ?", term.utc.min) if term.min > 0
343
- timed
342
+ if term.respond_to?(:strftime)
343
+ timed = relation.where("EXTRACT(hour from #{sql_column}) = ?", term.utc.hour)
344
+ timed = timed.where("EXTRACT(minute from #{sql_column}) = ?", term.utc.min) if term.min > 0
345
+ timed
346
+ else
347
+ relation.none # It's an invalid entered date
348
+ end
344
349
  end
345
350
 
346
351
  return searched if searched
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.19.11'.freeze
2
+ VERSION = '2.19.12'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.19.11
4
+ version: 2.19.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-15 00:00:00.000000000 Z
11
+ date: 2024-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails