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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 321fc95249c26a00d4b85d4069621ee0cb5b67b2ad175f9858ee27f5a7fc4b8a
4
- data.tar.gz: '0739da512f7f81b020075e3e5087d590638a230684a149e4be90c742b3e03b96'
3
+ metadata.gz: b29fc5db8791ba9b260193329c9c59f579f95f85d449c15e522844f286558cf4
4
+ data.tar.gz: 3badd880747485fc2d39c990f8cdd3492ae634d1498c89c713dd706476d4dff8
5
5
  SHA512:
6
- metadata.gz: 3f3b13d166f18bf4e10f22442c043e6210d02fc78970356db61a97cdd6ea592067cfca8ee6830b63a7d6108081a5be7fb530ccc92eec0ed16d387662c386aafd
7
- data.tar.gz: d1af245f236104a0dbdc2cac529f1045bd342e90d09cecbb07ae591591dac31a4a8f7aef112a8e8373da067bb3f8164ed1e42837f773687543d8d7156c96da97
6
+ metadata.gz: f5ca3cb5955dcbe3da72b55347ea4c8c688d2affe7e7eb37acccfaa2845ad0dfa2024e7598082358143fcc5c7ae974ed16558db9b70a28717423b5dae01e5b7d
7
+ data.tar.gz: e4da8e2c6a11282b72e9d5e9478de1d35098223265aa5cdd5c813374a548f35ee9280fb6db2f19974c307a8ce2b52d83b9354a5f8069041ce9586e193356da18
@@ -1,13 +1,13 @@
1
1
  module Istox
2
2
  module Filter
3
- def self.order_data(query:, filters:)
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.paginate_data(query:, filters:)
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
@@ -1,3 +1,3 @@
1
1
  module Istox
2
- VERSION = '0.1.97-1'.freeze
2
+ VERSION = '0.1.97-2'.freeze
3
3
  end
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.1
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-25 00:00:00.000000000 Z
11
+ date: 2019-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny