File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -29,17 +29,13 @@ def send_meeting_emails(meeting)
2929
3030 def invite_students_to_event ( event , chapter )
3131 chapter_students ( chapter ) . each do |student |
32- next unless student . accepted_toc_at
33-
3432 invitation = Invitation . new ( event : event , member : student , role : 'Student' )
3533 EventInvitationMailer . invite_student ( event , student , invitation ) . deliver_now if invitation . save
3634 end
3735 end
3836
3937 def invite_coaches_to_event ( event , chapter )
4038 chapter_coaches ( chapter ) . each do |coach |
41- next unless coach . accepted_toc_at
42-
4339 invitation = Invitation . new ( event : event , member : coach , role : 'Coach' )
4440 EventInvitationMailer . invite_coach ( event , coach , invitation ) . deliver_now if invitation . save
4541 end
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ class Member < ApplicationRecord
2020 validates :email , uniqueness : true
2121 validates :about_you , length : { maximum : 255 }
2222
23+ scope :accepted_toc , -> { where . not ( accepted_toc_at : nil ) }
2324 scope :order_by_email , -> { order ( :email ) }
2425 scope :subscribers , -> { joins ( :subscriptions ) . order ( 'created_at desc' ) . uniq }
2526 scope :not_banned , lambda {
@@ -32,7 +33,9 @@ class Member < ApplicationRecord
3233 . where ( 'meeting_invitations.meeting_id = ? and meeting_invitations.attending = ?' ,
3334 meeting . id , true )
3435 }
35- scope :in_group , -> ( members ) { not_banned . joins ( :groups ) . where ( groups : { id : members . select ( :id ) } ) }
36+ scope :in_group , lambda { |members |
37+ not_banned . accepted_toc . joins ( :groups ) . where ( groups : { id : members . select ( :id ) } )
38+ }
3639
3740 scope :with_skill , -> ( skill_name ) { tagged_with ( skill_name ) }
3841
You can’t perform that action at this time.
0 commit comments