diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/holiday_controller.rb | 2 | ||||
-rw-r--r-- | app/models/holiday.rb | 5 | ||||
-rw-r--r-- | app/models/info_request.rb | 6 |
3 files changed, 7 insertions, 6 deletions
diff --git a/app/controllers/holiday_controller.rb b/app/controllers/holiday_controller.rb index 7f62aa26d..1f81830f9 100644 --- a/app/controllers/holiday_controller.rb +++ b/app/controllers/holiday_controller.rb @@ -14,7 +14,7 @@ class HolidayController < ApplicationController def due_date if params[:holiday] @request_date = Date.strptime(params[:holiday]) or raise "Invalid date" - @due_date = Holiday.due_date_from(@request_date, 20) + @due_date = Holiday.due_date_from_working_days(@request_date, 20) @skipped = Holiday.all( :conditions => [ 'day >= ? AND day <= ?', @request_date.strftime("%F"), @due_date.strftime("%F") diff --git a/app/models/holiday.rb b/app/models/holiday.rb index 490fdb8c7..1d70c12a3 100644 --- a/app/models/holiday.rb +++ b/app/models/holiday.rb @@ -32,9 +32,10 @@ class Holiday < ActiveRecord::Base date.wday == 0 || date.wday == 6 || holidays.include?(date) end - # Calculate the date on which a request made on a given date falls due. + # Calculate the date on which a request made on a given date falls due when + # days are given in working days # i.e. it is due by the end of that day. - def Holiday.due_date_from(start_date, working_days) + def Holiday.due_date_from_working_days(start_date, working_days) # convert date/times into dates start_date = start_date.to_date diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 2e16d0f58..b34f51df2 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -688,7 +688,7 @@ public # things, e.g. fees, not properly covered. def date_response_required_by days_later = MySociety::Config.get('REPLY_LATE_AFTER_DAYS', 20) - return Holiday.due_date_from(self.date_initial_request_last_sent_at, days_later) + return Holiday.due_date_from_working_days(self.date_initial_request_last_sent_at, days_later) end # This is a long stop - even with UK public interest test extensions, 40 # days is a very long time. @@ -698,10 +698,10 @@ public 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) + return Holiday.due_date_from_working_days(self.date_initial_request_last_sent_at, 60) else # public interest test ICO guidance gives 40 working maximum - return Holiday.due_date_from(self.date_initial_request_last_sent_at, 40) + return Holiday.due_date_from_working_days(self.date_initial_request_last_sent_at, 40) end end |