tramway-event 1.9.1 → 1.9.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: 3df1b0d7ef6fd03c69869cc2ae56bd89fd61126934eb8ea08726a675231e4dfa
4
- data.tar.gz: e7c4951e8480719da7d7bc2442cfe8546aa6dc126b60f5cbe7479b25b81993be
3
+ metadata.gz: 6d9103eadd50c9621d5811222c3fe58531ab5c97f4d6644b52f79b932b5972db
4
+ data.tar.gz: 513815f3f055e85378c254b336a02452ee8e084fc209ee7db86d3f65c2380512
5
5
  SHA512:
6
- metadata.gz: 8e89a0960b154e3939413e1c6f8c21d5a276dc525dbb813b8fb78192760e1704d44fa1f13144a1b1e2083bf28c1d17594c6ca38fd8b3c45523af16ef4bb0cc04
7
- data.tar.gz: 9bed6361560bba5e715fe1bc053cff3d40b6d96b9bd6903651661ff3f186bfc0988c1720f1ff6062b8c155fb0331a309dae4f852476295c2d0bf1182569ce44d
6
+ metadata.gz: 73dd563cfbc42ed48f80d5ed5e574e59bae6e16588b02dcb9ba11ad8bf8d3978e70584fc7b210e997a29c2a161ded3b04e4d85410933042b7c1a0332df3933b8
7
+ data.tar.gz: b79e1c529152a683b1dc164671f6fdb8a46c85fd130b3059c3949c78fbadf1b38011de58561c7569ff0104f120e3401f988ed3ea6d592aef97c655fd4bf5cd26
@@ -8,11 +8,6 @@ class Tramway::Event::Event < ::Tramway::Event::ApplicationRecord
8
8
  has_many :partnerships, class_name: 'Tramway::Partner::Partnership', as: :partner
9
9
  has_many :organizations, as: :partners, through: :partnerships, class_name: 'Tramway::Partner::Organization'
10
10
 
11
- ::Tramway::Partner::Partnership.partnership_type.values.each do |partnership_type|
12
- has_many partnership_type.pluralize.to_sym, (-> do
13
- joins(:partnerships).where 'tramway_partner_partnerships.partnership_type = ? AND tramway_partner_partnerships.state = \'active\'', partnership_type
14
- end), foreign_key: :organization_id, source: :organization, through: :partnerships, class_name: 'Tramway::Partner::Organization'
15
- end
16
11
 
17
12
  enumerize :status, default: :common, in: [ :common, :main ]
18
13
 
@@ -27,4 +22,15 @@ class Tramway::Event::Event < ::Tramway::Event::ApplicationRecord
27
22
  return :are_being_right_now if request_collecting_begin_date&.past? && request_collecting_end_date&.future?
28
23
  end
29
24
 
25
+ ::Tramway::Partner::Partnership.partnership_type.values.each do |partnership_type|
26
+ define_method partnership_type.pluralize.to_sym do
27
+ query = <<-SQL
28
+ tramway_partner_partnerships.partnership_type = '#{partnership_type}'
29
+ AND tramway_partner_partnerships.partner_id = '#{id}'
30
+ AND tramway_partner_partnerships.state = 'active'
31
+ AND tramway_partner_partnerships.partner_type = 'Tramway::Event::Event'
32
+ SQL
33
+ Tramway::Partner::Organization.joins(:partnerships).where(query)
34
+ end
35
+ end
30
36
  end
@@ -1,5 +1,5 @@
1
1
  module Tramway
2
2
  module Event
3
- VERSION = '1.9.1'
3
+ VERSION = '1.9.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-event
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 1.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov