diff options
author | tony <tony> | 2009-03-05 11:40:10 +0000 |
---|---|---|
committer | tony <tony> | 2009-03-05 11:40:10 +0000 |
commit | 86e02361a2e4c40626b431e0340218baa2bd9b63 (patch) | |
tree | 4f696a0d74bbb13600bc5b54b029746214b5706e /app/models/info_request.rb | |
parent | 407b762bf366854fbe0dcca50a3e48c5af0eab1e (diff) |
No need to perform overdue check unless status is 'waiting_response' as
we currently ignore the result otherwise.
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r-- | app/models/info_request.rb | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index c6fc46dfe..e9d128523 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -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.167 2009-03-04 11:26:35 tony Exp $ +# $Id: info_request.rb,v 1.168 2009-03-05 11:40:10 tony Exp $ require 'digest/sha1' require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian') @@ -353,28 +353,12 @@ public # waiting_classification # waiting_response_overdue 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") - if date_today > date_response - overdue = true - else - overdue = false - end - - if self.described_state == "waiting_response" - if overdue - return 'waiting_response_overdue' - else - return 'waiting_response' - end - end - - return self.described_state + return 'waiting_classification' if self.awaiting_description + return self.described_state unless self.described_state == "waiting_response" + # Compare by date, so only overdue on next day, not if 1 second late + return 'waiting_response_overdue' if + Time.now.strftime("%Y-%m-%d") > date_response_required_by.strftime("%Y-%m-%d") + return 'waiting_response' end # Fill in any missing event states for first response before a description |