aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2011-08-12 16:24:23 +0100
committerSeb Bacon <seb.bacon@gmail.com>2011-08-12 16:24:23 +0100
commitfd3763c2a20af24428307a0dd1936d927ed323e2 (patch)
tree04fb750313c43ad970b3ee477002196cdbbae786
parentdbac4121cae0d620c7c11c6731fe5344ff1c677e (diff)
When displaying information about how overdue something is, use values from the config file, rather than hard coded ones. Fixes #130.
-rw-r--r--app/controllers/request_controller.rb2
-rw-r--r--app/models/info_request.rb2
-rw-r--r--config/general.yml-example3
-rw-r--r--spec/controllers/request_controller_spec.rb2
4 files changed, 8 insertions, 1 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index dff03983b..42d54a403 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -393,7 +393,7 @@ class RequestController < ApplicationController
flash[:notice] = _("<p>Thank you! Hope you don't have to wait much longer.</p> <p>By law, you should have got a response promptly, and normally before the end of <strong>{{date_response_required_by}}</strong>.</p>",:date_response_required_by=>simple_date(@info_request.date_response_required_by))
redirect_to request_url(@info_request)
elsif @info_request.calculate_status == 'waiting_response_very_overdue'
- flash[:notice] = _("<p>Thank you! Your request is long overdue, by more than 40 working days. Most requests should be answered within 20 working days. You might like to complain about this, see below.</p>")
+ flash[:notice] = _("<p>Thank you! Your request is long overdue, by more than {{very_late_number_of_days}} working days. Most requests should be answered within {{late_number_of_days}} working days. You might like to complain about this, see below.</p>", :very_late_number_of_days => MySociety::Config.get('REPLY_VERY_LATE_AFTER_DAYS', 40), :late_number_of_days => MySociety::Config.get('REPLY_LATE_AFTER_DAYS', 20))
redirect_to unhappy_url(@info_request)
elsif @info_request.calculate_status == 'not_held'
flash[:notice] = _("<p>Thank you! Here are some ideas on what to do next:</p>
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 419546c99..c667e1499 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -651,6 +651,8 @@ public
# days is a very long time.
def date_very_overdue_after
last_sent = last_event_forming_initial_request
+ very_late_days_later = MySociety::Config.get('REPLY_VERY_LATE_AFTER_DAYS', 40)
+ school_very_late_days_later = MySociety::Config.get('SPECIAL_REPLY_VERY_LATE_AFTER_DAYS', 60)
if self.public_body.is_school?
# schools have 60 working days maximum (even over a long holiday)
return Holiday.due_date_from(self.date_initial_request_last_sent_at, 60)
diff --git a/config/general.yml-example b/config/general.yml-example
index c832111c7..3537cd792 100644
--- a/config/general.yml-example
+++ b/config/general.yml-example
@@ -23,6 +23,9 @@ USE_DEFAULT_BROWSER_LANGUAGE: true
# How many days should have passed before an answer to a request is officially late?
REPLY_LATE_AFTER_DAYS: 20
+REPLY_VERY_LATE_AFTER_DAYS: 40
+# We give some types of authority like schools a bit longer than everyone else
+SPECIAL_REPLY_VERY_LATE_AFTER_DAYS: 60
# example searches for the home page, semicolon delimited.
FRONTPAGE_SEARCH_EXAMPLES: 'Geraldine Quango; Department for Humpadinking'
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 4afc8f876..dcd33d279 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -778,6 +778,8 @@ describe RequestController, "when classifying an information request" do
@dog_request.stub!(:date_very_overdue_after).and_return(Time.now.to_date-1)
expect_redirect('waiting_response', unhappy_url)
flash[:notice].should match(/is long overdue/)
+ flash[:notice].should match(/by more than 40 working days/)
+ flash[:notice].should match(/within 20 working days/)
end
it 'should redirect to the "request url" when status is updated to "not held"' do