diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/info_request.rb | 9 | ||||
-rw-r--r-- | app/models/raw_email.rb | 1 | ||||
-rw-r--r-- | app/models/track_mailer.rb | 6 |
3 files changed, 6 insertions, 10 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 9182b6ae7..e6a520fd2 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -347,14 +347,7 @@ public # XXX this *should* also check outgoing message joined to is an initial # request (rather than follow up) def InfoRequest.find_by_existing_request(title, public_body_id, body) - # XXX can add other databases here which have regexp_replace - if ActiveRecord::Base.connection.adapter_name == "PostgreSQL" - # Exclude spaces from the body comparison using regexp_replace - return InfoRequest.find(:first, :conditions => [ "title = ? and public_body_id = ? and regexp_replace(outgoing_messages.body, '[[:space:]]', '', 'g') = regexp_replace(?, '[[:space:]]', '', 'g')", title, public_body_id, body ], :include => [ :outgoing_messages ] ) - else - # For other databases (e.g. SQLite) not the end of the world being space-sensitive for this check - return InfoRequest.find(:first, :conditions => [ "title = ? and public_body_id = ? and outgoing_messages.body = ?", title, public_body_id, body ], :include => [ :outgoing_messages ] ) - end + return InfoRequest.find(:first, :conditions => [ "title = ? and public_body_id = ? and outgoing_messages.body = ?", title, public_body_id, body ], :include => [ :outgoing_messages ] ) end def find_existing_outgoing_message(body) diff --git a/app/models/raw_email.rb b/app/models/raw_email.rb index 7a57399d5..4e1a69456 100644 --- a/app/models/raw_email.rb +++ b/app/models/raw_email.rb @@ -6,7 +6,6 @@ # id :integer not null, primary key # data_text :text # data_binary :binary -# - prepared to 277k. # models/raw_email.rb: # The fat part of models/incoming_message.rb diff --git a/app/models/track_mailer.rb b/app/models/track_mailer.rb index 1b37709b9..6901a834d 100644 --- a/app/models/track_mailer.rb +++ b/app/models/track_mailer.rb @@ -26,7 +26,11 @@ class TrackMailer < ApplicationMailer @body = { :user => user, :email_about_things => email_about_things, :unsubscribe_url => unsubscribe_url } end - # Send email alerts for tracked things. + # Send email alerts for tracked things. Never more than one email + # a day, nor about events which are more than a week old, nor + # events about which emails have been sent within the last two + # weeks. + # Useful query to run by hand to see how many alerts are due: # User.find(:all, :conditions => [ "last_daily_track_email < ?", Time.now - 1.day ]).size def self.alert_tracks |