diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-06-11 15:57:06 -0700 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-06-11 15:57:06 -0700 |
commit | 6acc1d34d93234d79e6237bc86f6cb9fb01abc20 (patch) | |
tree | 21fbaea88ba21451b4dea8844ea7ac80f997b4ed | |
parent | 59b69d58a65256faee4b70a0cc71ce8929776547 (diff) |
Only do time calculation once.hotfix/0.11.0.9
-rw-r--r-- | app/mailers/track_mailer.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/mailers/track_mailer.rb b/app/mailers/track_mailer.rb index bc3c162a3..7157e12d8 100644 --- a/app/mailers/track_mailer.rb +++ b/app/mailers/track_mailer.rb @@ -39,6 +39,7 @@ class TrackMailer < ApplicationMailer def self.alert_tracks done_something = false now = Time.now() + 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 @@ -73,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 |