istox 0.1.96 → 0.1.97.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/istox/helpers/filter.rb +6 -8
- data/lib/istox/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 321fc95249c26a00d4b85d4069621ee0cb5b67b2ad175f9858ee27f5a7fc4b8a
|
4
|
+
data.tar.gz: '0739da512f7f81b020075e3e5087d590638a230684a149e4be90c742b3e03b96'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f3b13d166f18bf4e10f22442c043e6210d02fc78970356db61a97cdd6ea592067cfca8ee6830b63a7d6108081a5be7fb530ccc92eec0ed16d387662c386aafd
|
7
|
+
data.tar.gz: d1af245f236104a0dbdc2cac529f1045bd342e90d09cecbb07ae591591dac31a4a8f7aef112a8e8373da067bb3f8164ed1e42837f773687543d8d7156c96da97
|
data/lib/istox/helpers/filter.rb
CHANGED
@@ -1,17 +1,15 @@
|
|
1
1
|
module Istox
|
2
2
|
module Filter
|
3
|
-
def self.
|
4
|
-
current_page = filters.page
|
5
|
-
offset = (current_page - 1) * filters.limit
|
6
|
-
|
7
|
-
filters&.filter&.each do |x|
|
8
|
-
query = query.where("#{x.type.downcase} LIKE ?", "%#{x.value}%")
|
9
|
-
end
|
10
|
-
|
3
|
+
def self.order_data(query:, filters:)
|
11
4
|
filters&.sort&.each do |x|
|
12
5
|
query = query.order("#{x.field.downcase} #{x.order.upcase}")
|
13
6
|
end
|
7
|
+
query
|
8
|
+
end
|
14
9
|
|
10
|
+
def self.paginate_data(query:, filters:)
|
11
|
+
current_page = filters.page
|
12
|
+
offset = (current_page - 1) * filters.limit
|
15
13
|
total = query.count
|
16
14
|
data = query.limit(filters.limit).offset(offset)
|
17
15
|
|
data/lib/istox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: istox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.97.pre.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Siong Leng
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|
@@ -323,9 +323,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
323
323
|
version: '0'
|
324
324
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
325
325
|
requirements:
|
326
|
-
- - "
|
326
|
+
- - ">"
|
327
327
|
- !ruby/object:Gem::Version
|
328
|
-
version:
|
328
|
+
version: 1.3.1
|
329
329
|
requirements: []
|
330
330
|
rubygems_version: 3.0.6
|
331
331
|
signing_key:
|