grape-listing 1.3.7 → 1.3.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: acd02e7a894cb840c309ab56410c6f9a1d95d71659ce1a5089acecb47f134c9d
4
- data.tar.gz: 43ed8e46dfc72849eda90aac0bfa90efba57c2c0619e1fe884c7587b3e82e4d7
3
+ metadata.gz: 6ba8617bffac0ab4e4a01be9a04405601e47b623856460fac204877fc26317f7
4
+ data.tar.gz: aeca947deec2736192248fef996310e5848acd3575e176c9d708c5b6623d8799
5
5
  SHA512:
6
- metadata.gz: a96e3133ad15f5c9420643f778b1e9d83d0c5b695eb556b2447cbb8691fec2be19ab521afe76a152590897f81679efd8e9b39311f93d192ac42168d1321f8bf9
7
- data.tar.gz: 6797daf5af5484f99c39c0bce19b1e52be54068110217f24cd2cc6d1b9ecf73ad56171f0ba84ec2c8cd01b01b973d31e56281ca50ee0cbd6c6a245c3d1c0300d
6
+ metadata.gz: c4cf61f5dde0b861f2cbeb372c324a02eaf9a1b71dcb6ff573f48b427abf0a10c0e232dc1851414094d0e103ee4000950d6f1a8c97553b0e9c62d01d6ee3a972
7
+ data.tar.gz: cb98c65e16c43a058c1c513e223e6ff15b2a3b2a13acd538a29aba2167f232ebb363847123509efb54227ecf3abe8451bb43b6f7e34b808f676c5b7f83ca2c4d
@@ -20,7 +20,6 @@ module GrapeListing
20
20
  scope_name = operator.split('.')[1]
21
21
  # применение скоупа
22
22
  @objects = list.send(scope_name, value).distinct
23
- @objects_count = @objects.distinct.count
24
23
  next
25
24
  end
26
25
 
@@ -41,7 +40,10 @@ module GrapeListing
41
40
 
42
41
  query = where_query(table, field, operator, value)
43
42
  @objects = list.where(query)
44
- @objects_count = @objects.count
43
+ end
44
+
45
+ if @objects
46
+ @objects_count = @objects.distinct.count
45
47
  end
46
48
  end
47
49
 
@@ -55,8 +57,8 @@ module GrapeListing
55
57
  value = "%#{value}%" if operator == 'ilike' && value.present?
56
58
 
57
59
  # проверка мульти-поиска по параметру с массивом
58
- if value.is_a?(Array)
59
- operator = 'IN' if operator.exclude?('custom')
60
+ if value.is_a?(Array) && operator.exclude?('custom')
61
+ operator = 'IN'
60
62
  value = "(#{value.map { |i| "'#{i}'" }.join(', ')})"
61
63
  end
62
64
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-listing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.7
4
+ version: 1.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Павел Бабин