effective_mentorships 0.4.0 → 0.4.1

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: 984cc756545d2cc193f9653d63ab849aa43b33589b0de88021fa8b554102a6b2
4
- data.tar.gz: 3765acfee28560392a86fe6c7f3b4931fee360f8ae0383903f4b1cf842ed7700
3
+ metadata.gz: d44aadbbf12084b545f6f33ebb05f58b83cb8dbb8fc8f8d74bf3366aeb0a0c7e
4
+ data.tar.gz: df11f3c39ff546de09a7fcb27dfbd79950102f38cc7801fba57526a2b4a55462
5
5
  SHA512:
6
- metadata.gz: 96b76f61df6424149c0eb481136d6dde98c05568fd429dc015a6635513e994aef55e272ca63be3ca84167ac7c1d209e4a59c1f8484d7f0645e51c8d8c70633db
7
- data.tar.gz: a2be31e21892907cb7448fe8440e93f4da8884bb58730280b5cdfb64aead064a3e107bb15f84cb2e3e1ac9bd011ebe5706b90fda2bb627cf00e6eab2ee523330
6
+ metadata.gz: 3ed82bb50811e0f2e264f5524c224e0571a6c94eb12b654819151731562696aef9e34f81b932bb10e3aa7fd330f9217bf413de9561b67957457231f954ff0ba7
7
+ data.tar.gz: 8460ecc93151220f06b4265b745fae908b4ea61b479275b4a5ded946880a2d461b1929b2c0526b0329f1aac54f203125506aad47b6393fadb58bc08851d16b51
@@ -13,11 +13,11 @@ module Admin
13
13
  col 'user.last_name', visible: false
14
14
  col 'user.email', visible: false
15
15
 
16
- if defined?(EffectiveMemberships)
16
+ if defined?(EffectiveMemberships) && EffectiveMemberships.Membership
17
17
  col(:member_number, label: 'Member #', sort: false, visible: false) do |registration|
18
18
  registration.user.try(:membership).try(:number)
19
19
  end.search do |collection, term|
20
- memberships = Effective::Membership.where(owner_type: current_user.class.name).where('number ILIKE ?', "%#{term}%")
20
+ memberships = EffectiveMemberships.Membership.where(owner_type: current_user.class.name).where('number ILIKE ?', "%#{term}%")
21
21
  collection.where(user_id: memberships.select('owner_id'))
22
22
  end
23
23
 
@@ -26,7 +26,7 @@ module Admin
26
26
  content_tag(:div, membership_category, class: 'col-resource')
27
27
  end.join.html_safe
28
28
  end.search do |collection, term|
29
- memberships = Effective::Membership.where(owner_type: current_user.class.name).with_category(term)
29
+ memberships = EffectiveMemberships.Membership.where(owner_type: current_user.class.name).with_category(term)
30
30
  collection.where(user_id: memberships.select('owner_id'))
31
31
  end
32
32
 
@@ -35,7 +35,7 @@ module Admin
35
35
  content_tag(:div, status, class: 'col-resource')
36
36
  end.join.html_safe
37
37
  end.search do |collection, term|
38
- memberships = Effective::Membership.where(owner_type: current_user.class.name).with_status(term)
38
+ memberships = EffectiveMemberships.Membership.where(owner_type: current_user.class.name).with_status(term)
39
39
  collection.where(user_id: memberships.select('owner_id'))
40
40
  end
41
41
  end
@@ -13,11 +13,11 @@ module Admin
13
13
  col 'user.last_name', visible: false
14
14
  col 'user.email', visible: false
15
15
 
16
- if defined?(EffectiveMemberships)
16
+ if defined?(EffectiveMemberships) && EffectiveMemberships.Membership
17
17
  col(:member_number, label: 'Member #', sort: false, visible: false) do |registration|
18
18
  registration.user.try(:membership).try(:number)
19
19
  end.search do |collection, term|
20
- memberships = Effective::Membership.where(owner_type: current_user.class.name).where('number ILIKE ?', "%#{term}%")
20
+ memberships = EffectiveMemberships.Membership.where(owner_type: current_user.class.name).where('number ILIKE ?', "%#{term}%")
21
21
  collection.where(user_id: memberships.select('owner_id'))
22
22
  end
23
23
 
@@ -26,7 +26,7 @@ module Admin
26
26
  content_tag(:div, membership_category, class: 'col-resource')
27
27
  end.join.html_safe
28
28
  end.search do |collection, term|
29
- memberships = Effective::Membership.where(owner_type: current_user.class.name).with_category(term)
29
+ memberships = EffectiveMemberships.Membership.where(owner_type: current_user.class.name).with_category(term)
30
30
  collection.where(user_id: memberships.select('owner_id'))
31
31
  end
32
32
 
@@ -35,7 +35,7 @@ module Admin
35
35
  content_tag(:div, status, class: 'col-resource')
36
36
  end.join.html_safe
37
37
  end.search do |collection, term|
38
- memberships = Effective::Membership.where(owner_type: current_user.class.name).with_status(term)
38
+ memberships = EffectiveMemberships.Membership.where(owner_type: current_user.class.name).with_status(term)
39
39
  collection.where(user_id: memberships.select('owner_id'))
40
40
  end
41
41
  end
@@ -11,6 +11,9 @@ module Admin
11
11
  col :mentorship_group
12
12
  col :mentorship_role
13
13
  col :user
14
+ col :email do |registration|
15
+ registration.user.email
16
+ end
14
17
 
15
18
  actions_col
16
19
  end
@@ -4,6 +4,7 @@ module Admin
4
4
  scope :all
5
5
  scope :opt_in
6
6
  scope :opt_out
7
+ scope :opt_in_with_groups
7
8
  scope :opt_in_without_groups
8
9
  end
9
10
 
@@ -17,6 +18,9 @@ module Admin
17
18
 
18
19
  col :mentorship_cycle, search: :select
19
20
  col :user
21
+ col :email do |registration|
22
+ registration.user.email
23
+ end
20
24
 
21
25
  col :opt_in, visible: attributes[:opt_in_without_groups].blank?
22
26
 
@@ -96,27 +96,23 @@ module EffectiveMentorshipsRegistration
96
96
  scope :mentees, -> { where(mentorship_role: :mentee) }
97
97
  scope :opt_in, -> { where(opt_in: true) }
98
98
  scope :opt_out, -> { where(opt_in: false) }
99
+ scope :opt_in_with_groups, -> { opt_in.with_groups }
99
100
  scope :opt_in_without_groups, -> { opt_in.without_groups }
100
101
 
101
102
  scope :in_person, -> { where(venue: 'In-person') }
102
103
  scope :virtual, -> { where(venue: 'Virtual') }
103
104
  scope :either, -> { where(venue: 'Either') }
104
105
 
105
- scope :with_groups, -> {
106
- group_users = Effective::MentorshipGroupUser.all
106
+ scope :with_groups, -> {
107
+ group_users = Effective::MentorshipGroupUser.where.not(mentorship_registration_id: nil)
107
108
  where(id: group_users.select(:mentorship_registration_id))
108
109
  }
109
110
 
110
111
  scope :without_groups, -> {
111
- group_users = Effective::MentorshipGroupUser.all
112
+ group_users = Effective::MentorshipGroupUser.where.not(mentorship_registration_id: nil)
112
113
  where.not(id: group_users.select(:mentorship_registration_id))
113
114
  }
114
115
 
115
- scope :with_groups, -> {
116
- group_users = Effective::MentorshipGroupUser.all
117
- where(id: group_users.select(:mentorship_registration_id))
118
- }
119
-
120
116
  scope :with_groups_from, -> (mentorship_bulk_group) {
121
117
  groups = EffectiveMentorships.MentorshipGroup.where(mentorship_bulk_group: mentorship_bulk_group)
122
118
  group_users = Effective::MentorshipGroupUser.where(mentorship_group_id: groups.select(:mentorship_group_id))
@@ -1,3 +1,3 @@
1
1
  module EffectiveMentorships
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_mentorships
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect