istox 0.1.97.pre.1 → 0.1.97.pre.2
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 +7 -2
- data/lib/istox/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: b29fc5db8791ba9b260193329c9c59f579f95f85d449c15e522844f286558cf4
|
4
|
+
data.tar.gz: 3badd880747485fc2d39c990f8cdd3492ae634d1498c89c713dd706476d4dff8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5ca3cb5955dcbe3da72b55347ea4c8c688d2affe7e7eb37acccfaa2845ad0dfa2024e7598082358143fcc5c7ae974ed16558db9b70a28717423b5dae01e5b7d
|
7
|
+
data.tar.gz: e4da8e2c6a11282b72e9d5e9478de1d35098223265aa5cdd5c813374a548f35ee9280fb6db2f19974c307a8ce2b52d83b9354a5f8069041ce9586e193356da18
|
data/lib/istox/helpers/filter.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
module Istox
|
2
2
|
module Filter
|
3
|
-
def self.
|
3
|
+
def self.order(query:, filters:)
|
4
4
|
filters&.sort&.each do |x|
|
5
5
|
query = query.order("#{x.field.downcase} #{x.order.upcase}")
|
6
6
|
end
|
7
7
|
query
|
8
8
|
end
|
9
9
|
|
10
|
-
def self.
|
10
|
+
def self.paginate(query:, filters:)
|
11
11
|
current_page = filters.page
|
12
12
|
offset = (current_page - 1) * filters.limit
|
13
13
|
total = query.count
|
@@ -28,5 +28,10 @@ module Istox
|
|
28
28
|
}
|
29
29
|
}
|
30
30
|
end
|
31
|
+
|
32
|
+
def self.order_and_paginate(query:, filters:)
|
33
|
+
query = order(query: query, filters: filters)
|
34
|
+
paginate(query: query, filters: filters)
|
35
|
+
end
|
31
36
|
end
|
32
37
|
end
|
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.97.pre.
|
4
|
+
version: 0.1.97.pre.2
|
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-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|