Class: Workers::CheckBirthday

Inherits:
Base
  • Object
show all
Defined in:
app/workers/check_birthday.rb

Instance Method Summary collapse

Instance Method Details

#performObject


7
8
9
10
11
12
13
14
15
16
# File 'app/workers/check_birthday.rb', line 7

def perform
  profiles = Profile
             .where("EXTRACT(MONTH FROM birthday) = ?", Time.zone.today.month)
             .where("EXTRACT(DAY FROM birthday) = ?", Time.zone.today.day)
  profiles.each do |profile|
    profile.person.contacts.where(sharing: true, receiving: true).each do |contact|
      Notifications::ContactsBirthday.notify(contact, [])
    end
  end
end