motor-admin 0.1.61 → 0.1.62

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: 32c8b159e2bc232debb27c4998d0a06b78d11cb4dee7d9080bb3557f183ca788
4
- data.tar.gz: ec29e2a202609d5690deccb9ca2bc1d5b46438c80add5e5e6553cd9fb37bd02d
3
+ metadata.gz: 2b1e931dc58724b3ae9e207d86d4ca7a9c68d7cfeae0e0c482a7cd21d23c4258
4
+ data.tar.gz: d11ea5ce285bf4c44f6e772970b26bc7deede0b055e7c264c3039833c3d29534
5
5
  SHA512:
6
- metadata.gz: aeb234e7240f4ea926c9890f45d0bf24da8e7d811919d9584523fc9bd384403bac20c893316285cce76f217596131c78766a4092ff03f6bea5977334e70f30db
7
- data.tar.gz: 8c11a65a3e2c33bf05918e2544624498ae396fadf83e4a6ffb549f2dcf293d7217e9a740723bb4fb342c62acb6a8e8a13c11cb086e404e8341a72ae2f5a30616
6
+ metadata.gz: 05bef6829304b10adab88dc9860ad2b97c44a50cce1017cba21efcbc8799a7b996125bcc21abc8dbda3d333e4fd0aaa4200c03a565e51393d9d5c3018b00cd62
7
+ data.tar.gz: 40041861d8e1d81e76065862db59ab88713e799b9859867e91979f1e5ccc73bf6eeab77c3130108ac063da128d3a7d41db1da600c5c50f2301a4ddbefd15a29e
@@ -4,6 +4,7 @@ module Motor
4
4
  module ApiQuery
5
5
  module Filter
6
6
  LIKE_FILTER_VALUE_REGEXP = /\A%?(.*?)%?\z/.freeze
7
+ DISTINCT_DESTRICTED_COLUMN_TYPES = %i[json point].freeze
7
8
 
8
9
  module_function
9
10
 
@@ -12,7 +13,10 @@ module Motor
12
13
 
13
14
  normalized_params = normalize_params(Array.wrap(params))
14
15
 
15
- rel.filter(normalized_params).distinct
16
+ rel = rel.filter(normalized_params)
17
+ rel = rel.distinct if can_apply_distinct?(rel)
18
+
19
+ rel
16
20
  end
17
21
 
18
22
  def normalize_params(params)
@@ -47,6 +51,12 @@ module Motor
47
51
  end
48
52
  end
49
53
 
54
+ def can_apply_distinct?(rel)
55
+ rel.columns.none? do |column|
56
+ DISTINCT_DESTRICTED_COLUMN_TYPES.include?(column.type)
57
+ end
58
+ end
59
+
50
60
  def normalize_action(action, value)
51
61
  case action
52
62
  when 'includes'
data/lib/motor/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Motor
4
- VERSION = '0.1.61'
4
+ VERSION = '0.1.62'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motor-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.61
4
+ version: 0.1.62
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Matsyburka