mensa 0.6.6 → 0.6.7
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 +4 -4
- data/Gemfile.lock +1 -1
- data/app/tables/mensa/config/filter_dsl.rb +8 -6
- data/app/tables/mensa/filter.rb +6 -4
- data/lib/mensa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5b3079b6b5933b04de4724402439729cb927b3babb82d0e1fac213b0387519b5
|
|
4
|
+
data.tar.gz: e047c77dee4e3cc8b4d201cedaa73a971964441a486571083d6d0c32e4bceee5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 97ae78d7d5927361dc6492ed97249008a5c8eadf1e75452772a4334affe4f3d9291b110b0fb3752b948f2c45ee48701dc5aa57b45a32b8fbf4c4d57a49900a56
|
|
7
|
+
data.tar.gz: 33d2c0be01a6b3f0bb4e0f8f8ee6c8e9a7aba97369915d938f1231b60af8ac944435e063f265943dac893eeaf3b1bf7063f628698912dee33838e19c408b36dd
|
data/Gemfile.lock
CHANGED
|
@@ -2,12 +2,14 @@ module Mensa::Config
|
|
|
2
2
|
class FilterDsl
|
|
3
3
|
include DslLogic
|
|
4
4
|
|
|
5
|
-
option :operator, default: :is
|
|
6
|
-
option :value
|
|
7
|
-
|
|
8
|
-
option :
|
|
9
|
-
option :
|
|
5
|
+
option :operator, default: :is # Operator for filtering
|
|
6
|
+
option :value # Value for filtering
|
|
7
|
+
|
|
8
|
+
option :collection # Collection shown in filtering
|
|
9
|
+
option :scope # Scope for filtering
|
|
10
|
+
option :multiple, default: false # Multiple values allowed
|
|
10
11
|
option :as
|
|
11
|
-
option :operators
|
|
12
|
+
option :operators, default: [] # Supported operators
|
|
13
|
+
option :having, default: false # Needs having when filtering
|
|
12
14
|
end
|
|
13
15
|
end
|
data/app/tables/mensa/filter.rb
CHANGED
|
@@ -12,6 +12,7 @@ module Mensa
|
|
|
12
12
|
config_reader :value
|
|
13
13
|
config_reader :scope
|
|
14
14
|
config_reader :multiple
|
|
15
|
+
config_reader :having?
|
|
15
16
|
|
|
16
17
|
class << self
|
|
17
18
|
def OPERATORS
|
|
@@ -80,7 +81,7 @@ module Mensa
|
|
|
80
81
|
record_scope.instance_exec(normalize(value), &scope)
|
|
81
82
|
else
|
|
82
83
|
query, hash = query_and_hash_for_operator
|
|
83
|
-
record_scope = record_scope.where(query, hash) if query.present?
|
|
84
|
+
record_scope = (column.filter.having? ? record_scope.having(query, hash) : record_scope.where(query, hash)) if query.present?
|
|
84
85
|
record_scope
|
|
85
86
|
end
|
|
86
87
|
end
|
|
@@ -99,14 +100,15 @@ module Mensa
|
|
|
99
100
|
operators
|
|
100
101
|
end
|
|
101
102
|
|
|
103
|
+
# Used in the where clause
|
|
102
104
|
def query_and_hash_for_operator
|
|
103
|
-
hash = {
|
|
105
|
+
hash = {column: column.attribute_for_condition, value: normalize(value)}
|
|
104
106
|
|
|
105
107
|
query = case operator
|
|
106
108
|
when :is_empty
|
|
107
|
-
column.type == :string ? ":column IS NULL OR :column = ''" : ":column IS NULL"
|
|
109
|
+
(column.type == :string) ? ":column IS NULL OR :column = ''" : ":column IS NULL"
|
|
108
110
|
when :isnt_empty
|
|
109
|
-
column.type == :string ? ":column IS NOT NULL AND :column != ''" : ":column IS NOT NULL"
|
|
111
|
+
(column.type == :string) ? ":column IS NOT NULL AND :column != ''" : ":column IS NOT NULL"
|
|
110
112
|
when :is_current
|
|
111
113
|
":column = :value"
|
|
112
114
|
when :matches
|
data/lib/mensa/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mensa
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tom de Grunt
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-06-
|
|
11
|
+
date: 2026-06-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|