Created
June 17, 2014 15:14
-
-
Save stevenabrooks/e25d841f0d29f74d99ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.send_all_hourly_notifications | |
sql_condition = <<eos | |
folders.discarded = 0 | |
and users.email_updates = 1 | |
and users.email not in (select email from email_blacklist) | |
and users.invalid_email != 1 | |
and folder_members.frequency = 'hourly' | |
and folder_members.email_updates = 1 | |
and folder_members.discarded = 0 | |
eos | |
Folder.find(:all, :conditions => sql_condition, :joins => "folders, users, folder_members").each do |folder| | |
folder.batch_email_notifications(:period => :hourly) | |
Emails::Folders.deliver_batches if Emails::Folders.current_batch_size > 100 | |
end | |
Emails::Folders.deliver_batches | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment