aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/contact_validator.rb4
-rw-r--r--app/models/incoming_message.rb5
-rw-r--r--app/models/info_request.rb18
-rw-r--r--app/models/info_request_event.rb4
-rw-r--r--app/models/outgoing_message.rb4
-rw-r--r--app/models/post_redirect.rb4
-rw-r--r--app/models/public_body.rb4
-rw-r--r--app/models/public_body_tag.rb4
-rw-r--r--app/models/track_thing.rb4
-rw-r--r--app/models/track_things_sent_email.rb4
-rw-r--r--app/models/user.rb4
-rw-r--r--app/models/user_info_request_sent_alert.rb4
12 files changed, 36 insertions, 27 deletions
diff --git a/app/models/contact_validator.rb b/app/models/contact_validator.rb
index 78c30e553..9d114bd85 100644
--- a/app/models/contact_validator.rb
+++ b/app/models/contact_validator.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 59
+# Schema version: 60
#
# Table name: contact_validators
#
@@ -15,7 +15,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: contact_validator.rb,v 1.17 2008-07-16 23:45:41 francis Exp $
+# $Id: contact_validator.rb,v 1.18 2008-07-17 10:32:01 francis Exp $
class ContactValidator < ActiveRecord::BaseWithoutTable
column :name, :string
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 653097bab..eec02d899 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 59
+# Schema version: 60
#
# Table name: incoming_messages
#
@@ -9,6 +9,7 @@
# created_at :datetime not null
# updated_at :datetime not null
# cached_attachment_text :text
+# cached_main_body_text :text
#
# models/incoming_message.rb:
@@ -18,7 +19,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: incoming_message.rb,v 1.121 2008-07-17 03:30:54 francis Exp $
+# $Id: incoming_message.rb,v 1.122 2008-07-17 10:32:01 francis Exp $
# TODO
# Move some of the (e.g. quoting) functions here into rblib, as they feel
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 60e2a15d8..8aad5b534 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 59
+# Schema version: 60
#
# Table name: info_requests
#
@@ -23,7 +23,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: info_request.rb,v 1.121 2008-07-16 23:45:41 francis Exp $
+# $Id: info_request.rb,v 1.122 2008-07-17 10:32:01 francis Exp $
require 'digest/sha1'
require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian')
@@ -299,7 +299,7 @@ public
end
end
- # Work out what the situation of the request is In addition to values of
+ # Work out what the situation of the request is. In addition to values of
# self.described_state, can take these two values:
# waiting_classification
# waiting_response_overdue
@@ -328,13 +328,16 @@ public
return self.described_state
end
- # Fill in any missing event states for first response before a
- # description was made.
+ # Fill in any missing event states for first response before a description
+ # was made. i.e. We take the last described state in between two responses
+ # (inclusive of earlier), and set it as calculated value for the earlier
+ # response.
def calculate_event_states
curr_state = nil
for event in self.info_request_events.reverse
if not event.described_state.nil? and curr_state.nil?
curr_state = event.described_state
+ STDERR.puts "curr_state " + curr_state
end
if !curr_state.nil? && event.event_type == 'response'
@@ -348,6 +351,11 @@ public
event.save!
end
curr_state = nil
+ elsif !curr_state.nil? && event.event_type == 'followup_sent' && !event.described_state.nil? && event.described_state == 'waiting_response'
+ # followups can set the status to waiting response, which we don't
+ # want to propogate to the response itself, as that might already be
+ # set to waiting_clarification, which we want to know about.
+ curr_state = nil
end
end
end
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 7a76649ba..15e758275 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 59
+# Schema version: 60
#
# Table name: info_request_events
#
@@ -20,7 +20,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: info_request_event.rb,v 1.48 2008-07-17 03:30:54 francis Exp $
+# $Id: info_request_event.rb,v 1.49 2008-07-17 10:32:01 francis Exp $
class InfoRequestEvent < ActiveRecord::Base
belongs_to :info_request
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
index 74a3f0f6d..0b8276ca3 100644
--- a/app/models/outgoing_message.rb
+++ b/app/models/outgoing_message.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 59
+# Schema version: 60
#
# Table name: outgoing_messages
#
@@ -21,7 +21,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: outgoing_message.rb,v 1.55 2008-07-16 23:45:41 francis Exp $
+# $Id: outgoing_message.rb,v 1.56 2008-07-17 10:32:01 francis Exp $
class OutgoingMessage < ActiveRecord::Base
belongs_to :info_request
diff --git a/app/models/post_redirect.rb b/app/models/post_redirect.rb
index 487b5b74d..edc9ed63f 100644
--- a/app/models/post_redirect.rb
+++ b/app/models/post_redirect.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 59
+# Schema version: 60
#
# Table name: post_redirects
#
@@ -26,7 +26,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: post_redirect.rb,v 1.35 2008-07-16 23:45:41 francis Exp $
+# $Id: post_redirect.rb,v 1.36 2008-07-17 10:32:01 francis Exp $
require 'openssl' # for random bytes function
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index ea8097f89..233468854 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 59
+# Schema version: 60
#
# Table name: public_bodies
#
@@ -23,7 +23,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: public_body.rb,v 1.86 2008-07-16 23:55:49 francis Exp $
+# $Id: public_body.rb,v 1.87 2008-07-17 10:32:01 francis Exp $
require 'csv'
require 'set'
diff --git a/app/models/public_body_tag.rb b/app/models/public_body_tag.rb
index 927ad01f6..4f5e48fdb 100644
--- a/app/models/public_body_tag.rb
+++ b/app/models/public_body_tag.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 59
+# Schema version: 60
#
# Table name: public_body_tags
#
@@ -15,7 +15,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: public_body_tag.rb,v 1.14 2008-07-16 23:45:41 francis Exp $
+# $Id: public_body_tag.rb,v 1.15 2008-07-17 10:32:01 francis Exp $
class PublicBodyTag < ActiveRecord::Base
validates_presence_of :public_body
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index ec7fe271c..301e34f18 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 59
+# Schema version: 60
#
# Table name: track_things
#
@@ -21,7 +21,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: track_thing.rb,v 1.25 2008-07-16 23:45:41 francis Exp $
+# $Id: track_thing.rb,v 1.26 2008-07-17 10:32:01 francis Exp $
class TrackThing < ActiveRecord::Base
belongs_to :tracking_user, :class_name => 'User'
diff --git a/app/models/track_things_sent_email.rb b/app/models/track_things_sent_email.rb
index f9fea165a..ccfc79cb4 100644
--- a/app/models/track_things_sent_email.rb
+++ b/app/models/track_things_sent_email.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 59
+# Schema version: 60
#
# Table name: track_things_sent_emails
#
@@ -18,7 +18,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: track_things_sent_email.rb,v 1.8 2008-07-16 23:45:41 francis Exp $
+# $Id: track_things_sent_email.rb,v 1.9 2008-07-17 10:32:01 francis Exp $
class TrackThingsSentEmail < ActiveRecord::Base
belongs_to :info_request_event
diff --git a/app/models/user.rb b/app/models/user.rb
index 5f7f45d04..e903bc09d 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 59
+# Schema version: 60
#
# Table name: users
#
@@ -21,7 +21,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: user.rb,v 1.58 2008-07-16 23:45:41 francis Exp $
+# $Id: user.rb,v 1.59 2008-07-17 10:32:01 francis Exp $
require 'digest/sha1'
diff --git a/app/models/user_info_request_sent_alert.rb b/app/models/user_info_request_sent_alert.rb
index e940df2a0..c80c834b8 100644
--- a/app/models/user_info_request_sent_alert.rb
+++ b/app/models/user_info_request_sent_alert.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 59
+# Schema version: 60
#
# Table name: user_info_request_sent_alerts
#
@@ -17,7 +17,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: user_info_request_sent_alert.rb,v 1.18 2008-07-16 23:45:41 francis Exp $
+# $Id: user_info_request_sent_alert.rb,v 1.19 2008-07-17 10:32:01 francis Exp $
class UserInfoRequestSentAlert < ActiveRecord::Base
belongs_to :user