Class: ConsolidatedItemEmailJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/consolidated_item_email_job.rb

Instance Method Summary collapse

Instance Method Details

#performObject

Start with opening reminders.


4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/jobs/consolidated_item_email_job.rb', line 4

def perform
  # Find courses which are just past midnight, then create an opening reminder activity
  # Use that activity to notify the course
  midnight_time_zones = ActiveSupport::TimeZone.all.select { |time| time.now.hour == 0 }.
                        map(&:name)
  ActsAsTenant.without_tenant do
    courses = Course.where(time_zone: midnight_time_zones)
    courses.each do |course|
      Course::ConsolidatedOpeningReminderNotifier.opening_reminder(course)
    end
  end
end