visual_condition_builder 2.2.5 → 2.2.6

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
  SHA1:
3
- metadata.gz: 26021bfbd88d7ac0fad11a8172695a2a8da0b317
4
- data.tar.gz: 5dba04e77e8fe29cea12d8d2279cc82eb8cccf2c
3
+ metadata.gz: 4596aae923f37f0628c5a4dd2197879b6a00260c
4
+ data.tar.gz: b9c1d36ecf19d852a39fd0f9f6f1756cbaec1449
5
5
  SHA512:
6
- metadata.gz: d0013e13f5af265c50679ca047bc35d371cdddf3f26249c0a3d253c1dca68b2bf1de9caf432c8c9ee8b3a9c5f6d1ec22937c12a67545b031ce199cda77c4c0bd
7
- data.tar.gz: 4538f3e46b1a1b87511d5f4c1e393860df48b4b1482285c32bc0e065950b241a9a3ef4cd735393f700825c52ef4c9032521c852a3ece3a045047e5c5a0994bf9
6
+ metadata.gz: 34035631b016918f186be5ed191f7c804dc8bd688e30b7c55941735787ed3d996dac0eae4cb1386330fd8719832e98dbdbb61d858a6a7136de170e3d52bf2c0d
7
+ data.tar.gz: 1ab163643a37a9ec31307d60930112de4afea8e3fc51a051986604f7a878a9bd20f6fd9d49c010cba0a02ccc4777905fe0e4add73067acad3795e6b219360bca
data/README.md CHANGED
@@ -139,8 +139,9 @@ true | where a field is true | no_value: true, multiple: false
139
139
  not_true | Opposite :true | no_value: true, multiple: false
140
140
  false | where a field is false | no_value: true, multiple: false
141
141
  not_false | Opposite :false | no_value: true, multiple: false
142
- present | where a field is present (not null and not a blank string) | no_value: true, multiple: false
143
- blank | Opposite :present | no_value: true, multiple: false
142
+ present | where a field is present | no_value: true, multiple: false
143
+ not_present | where a field is not present | no_value: true, multiple: false
144
+ blank | where a field is blank | no_value: true, multiple: false
144
145
  null | where a field is null | no_value: true, multiple: false
145
146
  not_null | Opposite :null | no_value: true, multiple: false
146
147
 
@@ -31,7 +31,8 @@ en:
31
31
  not_true: 'not is true'
32
32
  "false": 'is false'
33
33
  not_false: 'not is false'
34
- present: 'is present '
34
+ present: 'is present'
35
+ not_present: 'not is present'
35
36
  blank: 'is blank'
36
37
  null: 'is null'
37
38
  not_null: 'not is null'
@@ -25,7 +25,8 @@ module VisualConditionBuilder
25
25
  when :next_week
26
26
  ransack_q["#{p[0]}_gteq"] = Date.today.next_week.beginning_of_week
27
27
  ransack_q["#{p[0]}_lteq"] = Date.today.next_week.end_of_week
28
- when :not_null, :null, :blank, :true, :not_true, :false, :not_false, :present
28
+ when :not_null, :null, :blank, :true, :not_true, :false, :not_false, :present, :not_present
29
+ #TODO: VALIDAR ESSES OPERADORES
29
30
  ransack_q["#{p[0]}_#{p[1]}"] = '1'
30
31
  else
31
32
  ransack_q["#{p[0]}_#{p[1]}"] = p[2]
@@ -109,15 +110,17 @@ module VisualConditionBuilder
109
110
  when :true
110
111
  tmp[p[0]] = 'true'
111
112
  when :not_true
112
- tmp[p[0]] = Hash["$ne", 'true']
113
+ tmp[p[0]] = Hash["$ne", true]
113
114
  when :false
114
115
  tmp[p[0]] = 'false'
115
116
  when :not_false
116
- tmp[p[0]] = Hash["$ne", 'false']
117
+ tmp[p[0]] = Hash["$ne", false]
117
118
  when :present
118
- tmp[p[0]] = Hash["$ne", '']
119
+ tmp[p[0]] = Hash["$exists", true]
120
+ when :not_present
121
+ tmp[p[0]] = Hash["$exists", false]
119
122
  when :blank
120
- tmp[p[0]] = ''
123
+ tmp[p[0]] = Hash["$in", ['null','']]
121
124
  when :null
122
125
  tmp[p[0]] = 'null'
123
126
  when :not_null
@@ -63,15 +63,15 @@ module VisualConditionBuilder
63
63
  type = type.present? ? normalized_name(type) : 'string'
64
64
  operators = case type
65
65
  when :date, :datetime
66
- [:eq, :between, :today, :yesterday, :tomorrow, :this_week, :last_week, :next_week, :present, :blank]
66
+ [:eq, :between, :today, :yesterday, :tomorrow, :this_week, :last_week, :next_week, :present, :not_present, :blank]
67
67
  when :time
68
- [:eq, :between, :present, :blank]
68
+ [:eq, :between, :present, :not_present, :blank]
69
69
  when :decimal, :integer
70
70
  [:eq, :between]
71
71
  when :boolean
72
- [:true, :false, :present, :blank]
72
+ [:true, :false, :present, :not_present, :blank]
73
73
  when :string
74
- [:cont, :eq, :start, :end, :present, :blank]
74
+ [:cont, :not_cont, :eq, :not_eq, :start, :end, :present, :not_present, :blank]
75
75
  else
76
76
  [:eq]
77
77
  end
@@ -135,6 +135,7 @@ module VisualConditionBuilder
135
135
  not_false: {no_value: true, multiple: false},
136
136
 
137
137
  present: {no_value: true, multiple: false},
138
+ not_present: {no_value: true, multiple: false},
138
139
  blank: {no_value: true, multiple: false},
139
140
 
140
141
  null: {no_value: true, multiple: false},
@@ -1,3 +1,3 @@
1
1
  module VisualConditionBuilder
2
- VERSION = "2.2.5"
2
+ VERSION = "2.2.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: visual_condition_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.5
4
+ version: 2.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Porto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-30 00:00:00.000000000 Z
11
+ date: 2017-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails