aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/info_request.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2011-07-06 10:35:56 +0100
committerSeb Bacon <seb.bacon@gmail.com>2011-07-06 10:35:56 +0100
commitfb183ab07052293acabde9fa249f5d1952d56465 (patch)
tree41667f77795a108b77be73e9de9824d9b4fab8da /app/models/info_request.rb
parent4d36238dbc2a239b48193b9089c3321a3103346f (diff)
parente7cd3adc2775b1450251f89d70680b3be8f291a3 (diff)
initial merge of Kosovan branch; still need to get tests passing, factor out Kosovan-specific code
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r--app/models/info_request.rb46
1 files changed, 29 insertions, 17 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index cab28b8f1..a36b140b8 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -57,6 +57,8 @@ class InfoRequest < ActiveRecord::Base
'waiting_response',
'waiting_clarification',
'gone_postal',
+ 'deadline_extended',
+ 'wrong_response',
'not_held',
'rejected', # this is called 'refused' in UK FOI law and the user interface, but 'rejected' internally for historic reasons
'successful',
@@ -511,6 +513,9 @@ public
# waiting_response_very_overdue
def calculate_status
return 'waiting_classification' if self.awaiting_description
+ # if deadline_extended expired do waiting_response_overdue
+ return 'waiting_response_overdue' if
+ self.described_state == "deadline_extended" && Time.now.strftime("%Y-%m-%d") > self.date_deadline_extended.strftime("%Y-%m-%d")
return 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_very_overdue' if
@@ -607,7 +612,7 @@ public
# last_event_forming_initial_request. There may be more obscure
# things, e.g. fees, not properly covered.
def date_response_required_by
- return Holiday.due_date_from(self.date_initial_request_last_sent_at, 20)
+ return Holiday.due_date_from(self.date_initial_request_last_sent_at, 7)
end
# This is a long stop - even with UK public interest test extensions, 40
# days is a very long time.
@@ -621,7 +626,10 @@ public
return Holiday.due_date_from(self.date_initial_request_last_sent_at, 40)
end
end
-
+ # deadline_extended
+ def date_deadline_extended
+ return Holiday.due_date_from(self.date_initial_request_last_sent_at, 15)
+ end
# Where the initial request is sent to
def recipient_email
return self.public_body.request_email
@@ -741,35 +749,39 @@ public
def display_status
status = self.calculate_status
if status == 'waiting_classification'
- "Awaiting classification."
+ _("Awaiting classification.")
elsif status == 'waiting_response'
- "Awaiting response."
+ _("Awaiting response.")
elsif status == 'waiting_response_overdue'
- "Delayed."
+ _("Delayed.")
elsif status == 'waiting_response_very_overdue'
- "Long overdue."
+ _("Long overdue.")
elsif status == 'not_held'
- "Information not held."
+ _("Information not held.")
elsif status == 'rejected'
- "Refused."
+ _("Refused.")
elsif status == 'partially_successful'
- "Partially successful."
+ _("Partially successful.")
elsif status == 'successful'
- "Successful."
+ _("Successful.")
elsif status == 'waiting_clarification'
- "Waiting clarification."
+ _("Waiting clarification.")
elsif status == 'gone_postal'
- "Handled by post."
+ _("Handled by post.")
+ elsif status == 'deadline_extended'
+ _("Deadline extended.")
+ elsif status == 'wrong_response'
+ _("Wrong Response.")
elsif status == 'internal_review'
- "Awaiting internal review."
+ _("Awaiting internal review.")
elsif status == 'error_message'
- "Delivery error"
+ _("Delivery error")
elsif status == 'requires_admin'
- "Unusual response."
+ _("Unusual response.")
elsif status == 'user_withdrawn'
- "Withdrawn by the requester."
+ _("Withdrawn by the requester.")
else
- raise "unknown status " + status
+ raise _("unknown status ") + status
end
end