diff options
-rw-r--r-- | app/models/holiday.rb | 25 | ||||
-rw-r--r-- | app/views/help/about.rhtml | 27 | ||||
-rw-r--r-- | spec/models/holiday_spec.rb | 9 |
3 files changed, 37 insertions, 24 deletions
diff --git a/app/models/holiday.rb b/app/models/holiday.rb index c3d8d01b2..cf67e6963 100644 --- a/app/models/holiday.rb +++ b/app/models/holiday.rb @@ -21,11 +21,12 @@ # Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: holiday.rb,v 1.7 2009-09-17 21:10:05 francis Exp $ +# $Id: holiday.rb,v 1.8 2009-09-17 21:30:15 francis Exp $ class Holiday < ActiveRecord::Base # Calculate the date on which a request made on a given date falls due. + # i.e. it is due by the end of that day. def Holiday.due_date_from(start_date) # convert date/times into dates start_date = start_date.to_date @@ -33,19 +34,19 @@ class Holiday < ActiveRecord::Base # TODO only fetch holidays after the start_date holidays = self.all.collect { |h| h.day }.to_set - # Count forward 20 working days. We start with today (or if not a working day, - # the next working day*) as "day zero". The first of the twenty full - # working days is the next day. We return the date of the last of the twenty. - # - # * See this response for example of a public authority complaining when we got - # that detail wrong: http://www.whatdotheyknow.com/request/policy_regarding_body_scans#incoming-1100 + # Count forward 20 working days. We start with today as "day zero". The + # first of the twenty full working days is the next day. We return the + # date of the last of the twenty. + + # This response for example of a public authority complains that we had + # it wrong. We didn't (even thought I changed the code for a while, + # it's changed back now). A day is a day, our lawyer tells us. + # http://www.whatdotheyknow.com/request/policy_regarding_body_scans#incoming-1100 - # We have to skip non-working days at start to find day zero, so start at - # day -1 and at yesterday, so we can do that. - days_passed = -1 - response_required_by = start_date - 1.day + days_passed = 0 + response_required_by = start_date - # Now step forward into day zero, and then each of the 20 days. + # Now step forward into each of the 20 days. while days_passed < 20 response_required_by += 1.day next if response_required_by.wday == 0 || response_required_by.wday == 6 # weekend diff --git a/app/views/help/about.rhtml b/app/views/help/about.rhtml index 17666634a..5baea6ed0 100644 --- a/app/views/help/about.rhtml +++ b/app/views/help/about.rhtml @@ -484,13 +484,22 @@ here is that the law says authorities must respond <strong>promptly</strong>.</p <p>If you've got a good reason why the request is going to take a while to process, requesters find it really helpful if you can send a quick email with a -sentence or two saying what is happening. FOI officers often have to do a lot -of <strong>hard work</strong> to answer requests, and this is hidden from the public. We think -it would help everyone to have more of that complexity visible.</p> +sentence or two saying what is happening. </p> -<p>All that said, WhatDoTheyKnow does attempt to show the maximum legal -deadline. Here is the complex detail of how we calculate it, and some things we -currently get wrong.</p> +<p>FOI officers often have to do a lot of <strong>hard work</strong> to answer +requests, and this is hidden from the public. We think it would help everyone +to have more of that complexity visible.</p> + +</dd> + +<dt id="days2">But really, you calculated it wrong!<a href="#days2">#</a> </dt> + +<dd> + +<p>The answer to the previous question not withstanding, WhatDoTheyKnow does +attempt to show the maximum legal deadline for response to each request. Here is +the complex detail of how we calculate it, and some things we currently get +wrong.</p> <ul> @@ -498,9 +507,9 @@ currently get wrong.</p> as "day zero", even if it was delivered late in the evening. Days end at midnight. We then count the next working day as "day one", and so on up to 20 days.</li> -<li>If the day the request email was sent was a non-working day, we count the -next working day as "day zero". This isn't required by law, but it is an extra -extension that some authorities expect.</li> +<li>If the day the request email was delivered was a non-working day, we count +the next working day as "day one". Delivery is delivery, even if it happened on +the weekend. Some authorities <a href="http://www.whatdotheyknow.com/request/policy_regarding_body_scans#incoming-1100">disagree with this</a>, our lawyer disagrees with them. </li> <li>We don't currently count extensions for Public Interest tests. Sorry about that, we're working on how best to present it on the site.</li> diff --git a/spec/models/holiday_spec.rb b/spec/models/holiday_spec.rb index 6179bb434..ebfdeba4b 100644 --- a/spec/models/holiday_spec.rb +++ b/spec/models/holiday_spec.rb @@ -27,12 +27,15 @@ describe Holiday, " when calculating due date" do due_date('2009-03-13').should == '2009-04-15' end + # Delivery at the weekend ends up the same due day as if it had arrived on + # the Friday before. This is because the next working day (Monday) counts + # as day 1. + # See http://www.whatdotheyknow.com/help/about#days it "handles Saturday start" do - due_date('2009-03-14').should == '2009-04-16' + due_date('2009-03-14').should == '2009-04-15' end - it "handles Sunday start" do - due_date('2009-03-15').should == '2009-04-16' + due_date('2009-03-15').should == '2009-04-15' end it "handles Monday start" do |