diff options
author | francis <francis> | 2008-03-07 23:13:37 +0000 |
---|---|---|
committer | francis <francis> | 2008-03-07 23:13:37 +0000 |
commit | 3bce538613a76beb3487284fab710a49310715aa (patch) | |
tree | d39f16a71b0fc0c234a26806e9451300bcc381f0 /app/models/info_request.rb | |
parent | 8551df974ca6cb7721cf90a548e9acfb424da1eb (diff) |
Index first message text with info requests themselves.
Fix routing for search queries with full stops in.
Public body search indexing.
User search indexing.
Link to specific users out of ones with same name.
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r-- | app/models/info_request.rb | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 9bff40a60..b6da611d9 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -21,7 +21,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.57 2008-03-06 20:10:29 francis Exp $ +# $Id: info_request.rb,v 1.58 2008-03-07 23:13:38 francis Exp $ require 'digest/sha1' @@ -64,7 +64,16 @@ class InfoRequest < ActiveRecord::Base end # Full text search indexing - acts_as_solr :fields => [ :title ], :if => "$do_solr_index" + acts_as_solr :fields => [ + :title, + :initial_request_text, + { :status => :string } +# { :created_at => :date } + ], :if => "$do_solr_index" + def status # for name in Solr queries + calculate_status + end + $do_solr_index = false def self.update_solr_index $do_solr_index = true @@ -79,7 +88,13 @@ class InfoRequest < ActiveRecord::Base raise "failed to solr_save" end for outgoing_message in info_request.outgoing_messages - outgoing_message.solr_save + # Initial request text is indexed for InfoRequest models - + # see :initial_request_text in acts_as_solr entry above + if outgoing_message.message_type != 'initial_request' + outgoing_message.solr_save + else + outgoing_message.solr_destroy + end end for incoming_message in info_request.incoming_messages incoming_message.solr_save @@ -210,6 +225,7 @@ public end # Work out what the situation of the request is + # waiting_classification # waiting_response # waiting_response_overdue # XXX calculated, should be cached for display? # waiting_clarification @@ -217,6 +233,10 @@ public # successful # partially_successful def calculate_status + if self.awaiting_description + return 'waiting_classification' + end + # See if response would be overdue date_today = Time.now.strftime("%Y-%m-%d") date_response = date_response_required_by.strftime("%Y-%m-%d") @@ -405,7 +425,7 @@ public # Display version of status def display_status status = self.calculate_status - if self.awaiting_description + if status == 'waiting_classification' "Awaiting classification." elsif status == 'waiting_response' "Awaiting response." |