diff options
author | tony <tony> | 2009-03-09 15:05:13 +0000 |
---|---|---|
committer | tony <tony> | 2009-03-09 15:05:13 +0000 |
commit | 2cc813640816ed1a5cd981beadd874e61970b477 (patch) | |
tree | d1d8fce28c97ef8defdb1e92e7e202efd3e1ad89 /app/models/info_request.rb | |
parent | 2d422f2a8c256061292b57710e291ebf2b135d1b (diff) |
Make holiday list a hash instead of a list, so we can report what the
skipped days were
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r-- | app/models/info_request.rb | 62 |
1 files changed, 49 insertions, 13 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 86920391a..4cb948cb4 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.173 2009-03-09 01:17:06 francis Exp $ +# $Id: info_request.rb,v 1.174 2009-03-09 15:05:13 tony Exp $ require 'digest/sha1' require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian') @@ -461,22 +461,58 @@ public # and isn't really an instance method as just expects to be passed a date # I don't really know where/how though (TB 2009-03-06) def due_date_for_request_date(request_date) - holidays = [ + holidays = { # Union of holidays from these places: + # http://www.direct.gov.uk/en/Governmentcitizensandrights/LivingintheUK/DG_073741 # http://www.dti.gov.uk/employment/bank-public-holidays/ # http://www.scotland.gov.uk/Publications/2005/01/bankholidays - '2007-11-30', '2007-12-25', '2007-12-26', - - '2008-01-01', '2008-01-02', '2008-03-17', '2008-03-21', '2008-03-24', '2008-05-05', - '2008-05-26', '2008-07-14', '2008-08-04', '2008-08-25', '2008-12-01', '2008-12-25', '2008-12-26', - - '2009-01-01', '2009-01-02', '2009-03-17', '2009-04-10', '2009-04-13', '2009-05-04', - '2009-05-25', '2009-07-13', '2009-08-03', '2009-08-31', '2009-11-30', '2009-12-25', '2009-12-28', - - '2010-01-01', '2010-01-04', '2010-03-17', '2010-04-02', '2010-04-05', '2010-05-03', - '2010-05-31', '2010-07-12', '2010-08-02', '2010-08-30', '2010-11-30', '2010-12-27', '2010-12-28' - ].to_set + '2007-11-30' => "St. Andrew's Day", + '2007-12-25' => "Christmas Day", + '2007-12-26' => "Boxing Day", + + '2008-01-01' => "New Year's Day", + '2008-01-02' => "2nd January (Scotland)", + '2008-03-17' => "St. Patrick's Day (NI)", + '2008-03-21' => "Good Friday", + '2008-03-24' => "Easter Monday", + '2008-05-05' => "Early May Bank Holiday", + '2008-05-26' => "Spring Bank Holiday", + '2008-07-14' => "Battle of the Boyne (NI)", + '2008-08-04' => "Summer Bank Holiday (Scotland)", + '2008-08-25' => "Summer Bank Holiday (England + Wales)", + '2008-12-01' => "St. Andrew's Day (Scotland)", + '2008-12-25' => "Christmas Day", + '2008-12-26' => "Boxing Day", + + '2009-01-01' => "New Year's Day", + '2009-01-02' => "2nd January (Scotland)", + '2009-03-17' => "St. Patrick's Day (NI)", + '2009-04-10' => "Good Friday", + '2009-04-13' => "Easter Monday", + '2009-05-04' => "Early May Bank Holiday", + '2009-05-25' => "Spring Bank Holiday", + '2009-07-13' => "Battle of the Boyne (NI)", + '2009-08-03' => "Summer Bank Holiday (Scotland)", + '2009-08-31' => "Summer Bank Holiday (England + Wales)", + '2009-11-30' => "St. Andrew's Day (Scotland)", + '2009-12-25' => "Christmas Day", + '2009-12-28' => "Boxing Day", + + '2010-01-01' => "New Year's Day", + '2010-01-04' => "2nd January (Scotland)", + '2010-03-17' => "St. Patrick's Day (NI)", + '2010-04-02' => "Good Friday", + '2010-04-05' => "Easter Monday", + '2010-05-03' => "Early May Bank Holiday", + '2010-05-31' => "Spring Bank Holiday", + '2010-07-12' => "Battle of the Boyne (NI)", + '2010-08-02' => "Summer Bank Holiday (Scotland)", + '2010-08-30' => "Summer Bank Holiday (England + Wales)", + '2010-11-30' => "St. Andrew's Day (Scotland)", + '2010-12-27' => "Christmas Day", + '2010-12-28' => "Boxing Day" + } # 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 |