Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ class EffectiveMentorshipGroupUsersDatatable < Effective::Datatable
col :mentorship_group
col :mentorship_role
col :user
col :email do |registration|
registration.user.email
end

actions_col
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class EffectiveMentorshipRegistrationsDatatable < Effective::Datatable
scope :all
scope :opt_in
scope :opt_out
scope :opt_in_with_groups
scope :opt_in_without_groups
end

Expand All @@ -17,6 +18,9 @@ class EffectiveMentorshipRegistrationsDatatable < Effective::Datatable

col :mentorship_cycle, search: :select
col :user
col :email do |registration|
registration.user.email
end

col :opt_in, visible: attributes[:opt_in_without_groups].blank?

Expand Down
12 changes: 4 additions & 8 deletions app/models/concerns/effective_mentorships_registration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,27 +96,23 @@ def locations
scope :mentees, -> { where(mentorship_role: :mentee) }
scope :opt_in, -> { where(opt_in: true) }
scope :opt_out, -> { where(opt_in: false) }
scope :opt_in_with_groups, -> { opt_in.with_groups }
scope :opt_in_without_groups, -> { opt_in.without_groups }

scope :in_person, -> { where(venue: 'In-person') }
scope :virtual, -> { where(venue: 'Virtual') }
scope :either, -> { where(venue: 'Either') }

scope :with_groups, -> {
group_users = Effective::MentorshipGroupUser.all
scope :with_groups, -> {
group_users = Effective::MentorshipGroupUser.where.not(mentorship_registration_id: nil)
where(id: group_users.select(:mentorship_registration_id))
}

scope :without_groups, -> {
group_users = Effective::MentorshipGroupUser.all
group_users = Effective::MentorshipGroupUser.where.not(mentorship_registration_id: nil)
where.not(id: group_users.select(:mentorship_registration_id))
}

scope :with_groups, -> {
group_users = Effective::MentorshipGroupUser.all
where(id: group_users.select(:mentorship_registration_id))
}

scope :with_groups_from, -> (mentorship_bulk_group) {
groups = EffectiveMentorships.MentorshipGroup.where(mentorship_bulk_group: mentorship_bulk_group)
group_users = Effective::MentorshipGroupUser.where(mentorship_group_id: groups.select(:mentorship_group_id))
Expand Down