diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-06-11 16:18:52 -0700 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-06-11 16:18:52 -0700 |
commit | 7adb0b61a8aa38940f1f77a2d16cc6d42d01b16b (patch) | |
tree | ce75fea3cd9eb305b405e14ce3e95d2621236786 /app | |
parent | b1b5f97cd5d84698d10841c977431756e975b216 (diff) | |
parent | 6acc1d34d93234d79e6237bc86f6cb9fb01abc20 (diff) |
Merge branch 'hotfix/0.11.0.9' into rails-3-develop
Diffstat (limited to 'app')
-rw-r--r-- | app/mailers/track_mailer.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/app/mailers/track_mailer.rb b/app/mailers/track_mailer.rb index 1bd8a7e23..8e9beded6 100644 --- a/app/mailers/track_mailer.rb +++ b/app/mailers/track_mailer.rb @@ -39,11 +39,9 @@ class TrackMailer < ApplicationMailer def self.alert_tracks done_something = false now = Time.now() - users = User.find(:all, :conditions => [ "last_daily_track_email < ?", now - 1.day ]) - if users.empty? - return done_something - end - for user in users + one_week_ago = now - 7.days + User.find_each(:conditions => [ "last_daily_track_email < ?", + now - 1.day ]) do |user| next if !user.should_be_emailed? || !user.receive_email_alerts email_about_things = [] @@ -80,7 +78,7 @@ class TrackMailer < ApplicationMailer end next if track_thing.created_at >= result[:model].described_at # made before the track was created - next if result[:model].described_at < now - 7.days # older than 1 week (see 14 days / 7 days in comment above) + next if result[:model].described_at < one_week_ago # older than 1 week (see 14 days / 7 days in comment above) next if done_info_request_events.include?(result[:model].id) # definitely already done # OK alert this one |