agilibox 1.5.5 → 1.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/app/filters/agilibox/small_data/filter_strategy_by_date_begin.rb +2 -1
- data/app/filters/agilibox/small_data/filter_strategy_by_date_end.rb +2 -1
- data/app/filters/agilibox/small_data/filter_strategy_by_date_or_datetime_period.rb +1 -1
- data/app/filters/agilibox/small_data/filter_strategy_by_key_value.rb +13 -3
- data/app/filters/agilibox/small_data/filter_strategy_by_key_values.rb +3 -8
- data/lib/agilibox/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: b89a1c4a5176d64607c6df1c179a5519858b7c7469bbbefd0d6c128ad1372e5c
|
4
|
+
data.tar.gz: 31e6c78eafb56b047a8c5af9df93067c3fbbd61958134e9fe36b22d56cdcf1fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c01d71e66266e67e467c2359be424c6407136d15dd8fcf4eddfce790f10242d9dcb33c39e69192c8e55d87d85a58d21008ac830df418306ddd0be2eb555fa8b
|
7
|
+
data.tar.gz: c469f7c350ec36085b4976c728bac1713a567b163ae682b670282f4e38924c4cf7704a188151635534c4b76c3dbdc997c46b208116d18144f5c71177845d6da5
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
class Agilibox::SmallData::FilterStrategyByDateBegin < ::Agilibox::SmallData::FilterStrategyByKeyValue
|
2
2
|
def apply(query, value)
|
3
3
|
value = Time.zone.parse(value).beginning_of_day
|
4
|
-
|
4
|
+
column = column_for(query)
|
5
|
+
query.where("#{column} >= ?", value)
|
5
6
|
end
|
6
7
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
class Agilibox::SmallData::FilterStrategyByDateEnd < ::Agilibox::SmallData::FilterStrategyByKeyValue
|
2
2
|
def apply(query, value)
|
3
3
|
value = Time.zone.parse(value).end_of_day
|
4
|
-
|
4
|
+
column = column_for(query)
|
5
|
+
query.where("#{column} <= ?", value)
|
5
6
|
end
|
6
7
|
end
|
@@ -46,7 +46,7 @@ class Agilibox::SmallData::FilterStrategyByDateOrDatetimePeriod < ::Agilibox::Sm
|
|
46
46
|
b = b.end_of_day if b
|
47
47
|
end
|
48
48
|
|
49
|
-
column =
|
49
|
+
column = column_for(query)
|
50
50
|
|
51
51
|
query = query.where("#{column} >= ?", a) if a
|
52
52
|
query = query.where("#{column} <= ?", b) if b
|
@@ -8,9 +8,19 @@ class Agilibox::SmallData::FilterStrategyByKeyValue < ::Agilibox::SmallData::Fil
|
|
8
8
|
def apply(query, value)
|
9
9
|
value = true if value == "true"
|
10
10
|
value = false if value == "false"
|
11
|
-
value = nil if value == "nil"
|
12
|
-
value = nil if value == "null"
|
13
11
|
|
14
|
-
|
12
|
+
column = column_for(query)
|
13
|
+
|
14
|
+
if value.to_s.in?(%w(nil null))
|
15
|
+
query.where("#{column} IS NULL")
|
16
|
+
elsif value.to_s.in?(%w(not_nil not_null))
|
17
|
+
query.where("#{column} IS NOT NULL")
|
18
|
+
else
|
19
|
+
query.where("#{column} = ?", value)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def column_for(query)
|
24
|
+
key.is_a?(Symbol) ? "#{query.model.table_name}.#{key}" : key.to_s
|
15
25
|
end
|
16
26
|
end
|
@@ -1,16 +1,11 @@
|
|
1
|
-
class Agilibox::SmallData::FilterStrategyByKeyValues < ::Agilibox::SmallData::
|
2
|
-
attr_reader :key
|
3
|
-
|
4
|
-
def initialize(key = nil)
|
5
|
-
@key = key
|
6
|
-
end
|
7
|
-
|
1
|
+
class Agilibox::SmallData::FilterStrategyByKeyValues < ::Agilibox::SmallData::FilterStrategyByKeyValue
|
8
2
|
def apply(query, value)
|
9
3
|
value = value.split(" ") if value.is_a?(String)
|
10
4
|
value = value.select(&:present?)
|
5
|
+
column = column_for(query)
|
11
6
|
|
12
7
|
if value.any?
|
13
|
-
query.where("#{
|
8
|
+
query.where("#{column} IN (?)", value)
|
14
9
|
else
|
15
10
|
query
|
16
11
|
end
|
data/lib/agilibox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agilibox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- agilidée
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails-i18n
|