klastera 1.1.3 → 1.1.4

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: 5852cf2afca5ca451495ec4edfc3424c2eef664b6f848bf0bf7160570cefc8e5
4
- data.tar.gz: 8d7cdd33fa148b3aa6186953c6e20b49570442229150684da761d6e82c5511c8
3
+ metadata.gz: 9bd206c969548ea6d299cb57564aa67e9f7b88a5ba753ad5d0c112b7670ad4f0
4
+ data.tar.gz: 62580be564273b2a461808c9edbe2e9ef6c1cefa88f8b813ec9d2d02441a0836
5
5
  SHA512:
6
- metadata.gz: 5044d1067b784b9b2a51fc77ddbd173478fc6b157126f13162ae329f4e276a449de01a2f0ef9318bf0dc8371ef933da9ff17e2d9f454446b0e4454663895168d
7
- data.tar.gz: a3d59a38ba31e0686e17ce57172ce999527cb0b1f900ae5f93cb5e737c6b42f3e165ad448dfeb4c8a178873c90a354c0c55c67755b6b0228bc5c8ceec57dce11
6
+ metadata.gz: d5f9073b9968cab43d2a88be5d1bcb9ac4cb6254670b480ac2adeadbe9c00bef78cd35a022f52626c75157844f9ad428c26afaab33b73b55e51b1bcfd0f0c682
7
+ data.tar.gz: 900d61f55072bfc19110dc4efda73c996dd7ec57e327165279e2c15b5eb86352c1f1aa98a28130b2b1f87a7d753a7891b388badee4a7771e6249fd758b662f5e
data/lib/klastera.rb CHANGED
@@ -15,17 +15,15 @@ module Klastera
15
15
 
16
16
  session_clusters(user,organization) do |clusters|
17
17
  clusters = clusters.reject{|c|c.id.blank?}
18
- with_clusters = nil; without_clusters = nil
19
18
 
20
- if organization.required_suborganization_mode? || clusters.present?
21
- with_clusters = "#{scope.table_name}.cluster_id IN (#{clusters.map(&:id).join(',')})"
22
- end
23
-
24
- if organization.optional_mode?
19
+ if organization.required_suborganization_mode?
20
+ scope_klass = scope_klass.where("#{scope.table_name}.cluster_id IN (?)",clusters)
21
+ elsif organization.optional_mode?
22
+ with_clusters = clusters.present? ? "#{scope.table_name}.cluster_id IN (#{clusters.map(&:id).join(',')})" : nil
25
23
  without_clusters = "#{with_clusters.blank? ? '' : ' OR ' }#{scope.table_name}.cluster_id IS NULL"
24
+ scope_klass = scope_klass.where("#{with_clusters}#{without_clusters}")
26
25
  end
27
26
 
28
- scope_klass = scope_klass.where("#{with_clusters}#{without_clusters}")
29
27
  end
30
28
 
31
29
  scope_klass
@@ -1,3 +1,3 @@
1
1
  module Klastera
2
- VERSION = "1.1.3"
2
+ VERSION = "1.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: klastera
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gino Barahona
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-07 00:00:00.000000000 Z
11
+ date: 2020-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails