diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-06-11 16:14:08 -0700 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-06-11 16:14:08 -0700 |
commit | 0ad2498b6ea689530af4b5de2b119da96f4d983c (patch) | |
tree | 21fbaea88ba21451b4dea8844ea7ac80f997b4ed /app/mailers | |
parent | b899d542efe424be83cf512c61e8cc0c5e3f0b1a (diff) | |
parent | 6acc1d34d93234d79e6237bc86f6cb9fb01abc20 (diff) |
Merge branch 'hotfix/0.11.0.9'0.11.0.9
Diffstat (limited to 'app/mailers')
-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 391143214..7157e12d8 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 = [] @@ -76,7 +74,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 |