1 module CALCULATION_COMMONS_ONLY_SITTING_DAYS
The calculation counts a day whenever the House of Commons has an actual sitting day - and requires the start date and the number of days to count.
The calculation is set out in section 5 (4A) of the Planning Act 2008.
7 def commons_only_sitting_days( date, target_day_count )
We continue to the day immediately following the start day.
If that day is or is followed by a House of Commons actual sitting day...
13 if date.next_day.first_commons_actual_sitting_day
... we set the date to the day of the first House of Commons actual sitting day following the start date.
16 date = date.next_day.first_commons_actual_sitting_day
... we have found the start of the scrutiny period.
19 @scrutiny_start_date = date
... we've found the first House of Commons actual sitting day so we start counting from day 1.
22 day_count = 1
... whilst the number of days we’re counting is less than the target number of days to count ...
25 while ( day_count < target_day_count ) do
... continue to the next day.
28 date = date.next_day
... and add 1 to the day count if this is a House of Commons actual sitting day.
31 day_count +=1 if date.is_commons_actual_sitting_day?
... if the calendar has no record of what type of day this is, we can't calculate the end date, ...
34 if date.is_calendar_not_populated?
... this error message is displayed to users ...
37 @error_message = "It's not currently possible to calculate an anticipated end date, as the likely end date occurs during a period for which sitting days are yet to be announced."
... and we stop looking through the calendar.
40 break
41 end
42 end
If day immediately following the laying day is not a House of Commons actual sitting day and is not followed by a House of Commons actual sitting day...
45 else
.. this error message is displayed to users.
48 @error_message = "Unable to find a future House of Commons sitting day. It's not currently possible to calculate an anticipated end date, as the likely end date occurs during a period for which sitting days are yet to be announced."
49 end
Return the anticipated end date of the scrutiny period for display.
52 date
53 end
54 end