Skip to content

Commit 1d14ba6

Browse files
authored
Merge pull request #4002 from nhsuk/academic-year-preparation-start-date
Academic year preparation start date
2 parents 09b5934 + e893af3 commit 1d14ba6

4 files changed

Lines changed: 80 additions & 13 deletions

File tree

app/lib/academic_year.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ def current = Date.current.academic_year
1111
# when changing the date in tests).
1212
def first = [2024, current].min
1313

14-
def last = current
14+
def last = preparation? ? current + 1 : current
15+
16+
def preparation? = Date.current >= preparation_start_date
17+
18+
private
19+
20+
def preparation_start_date
21+
start_date = (current + 1).to_academic_year_date_range.first
22+
days_of_preparation =
23+
Settings.number_of_preparation_days_before_academic_year_starts.to_i
24+
start_date - days_of_preparation.days
25+
end
1526
end
1627
end

config/settings.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ allow_dev_phone_numbers: false
55
disallow_database_seeding: true
66
web_concurrency: 2
77

8+
# Preparation normally starts on the 1st August.
9+
number_of_preparation_days_before_academic_year_starts: 31
10+
811
# NHS Care Identity Service OIDC integration configuration, used by Omniauth via
912
# Devise.
1013
cis2:

spec/lib/academic_year_spec.rb

Lines changed: 61 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,25 @@
44
describe "#all" do
55
subject { travel_to(today) { described_class.all } }
66

7-
context "in 2024" do
7+
context "first day of 2024" do
88
let(:today) { Date.new(2024, 9, 1) }
99

1010
it { should eq([2024]) }
1111
end
1212

13-
context "in 2025" do
13+
context "last day of only 2024" do
14+
let(:today) { Date.new(2025, 7, 31) }
15+
16+
it { should eq([2024]) }
17+
end
18+
19+
context "preparing for 2025" do
20+
let(:today) { Date.new(2025, 8, 1) }
21+
22+
it { should eq([2024, 2025]) }
23+
end
24+
25+
context "first day of 2025" do
1426
let(:today) { Date.new(2025, 9, 1) }
1527

1628
it { should eq([2024, 2025]) }
@@ -20,13 +32,13 @@
2032
describe "#current" do
2133
subject { travel_to(today) { described_class.current } }
2234

23-
context "in 2024" do
35+
context "first day of 2024" do
2436
let(:today) { Date.new(2024, 9, 1) }
2537

2638
it { should eq(2024) }
2739
end
2840

29-
context "in 2025" do
41+
context "first day of 2025" do
3042
let(:today) { Date.new(2025, 9, 1) }
3143

3244
it { should eq(2025) }
@@ -36,19 +48,19 @@
3648
describe "#first" do
3749
subject { travel_to(today) { described_class.first } }
3850

39-
context "in 2023" do
51+
context "first day of 2023" do
4052
let(:today) { Date.new(2023, 9, 1) }
4153

4254
it { should eq(2023) }
4355
end
4456

45-
context "in 2024" do
57+
context "first day of 2024" do
4658
let(:today) { Date.new(2024, 9, 1) }
4759

4860
it { should eq(2024) }
4961
end
5062

51-
context "in 2025" do
63+
context "first day of 2025" do
5264
let(:today) { Date.new(2025, 9, 1) }
5365

5466
it { should eq(2024) }
@@ -58,16 +70,56 @@
5870
describe "#last" do
5971
subject { travel_to(today) { described_class.last } }
6072

61-
context "in 2024" do
73+
context "first day of 2024" do
6274
let(:today) { Date.new(2024, 9, 1) }
6375

6476
it { should eq(2024) }
6577
end
6678

67-
context "in 2025" do
79+
context "last day of only 2024" do
80+
let(:today) { Date.new(2025, 7, 31) }
81+
82+
it { should eq(2024) }
83+
end
84+
85+
context "preparing for 2025" do
86+
let(:today) { Date.new(2025, 8, 1) }
87+
88+
it { should eq(2025) }
89+
end
90+
91+
context "first day of 2025" do
6892
let(:today) { Date.new(2025, 9, 1) }
6993

7094
it { should eq(2025) }
7195
end
7296
end
97+
98+
describe "#preparation?" do
99+
subject { travel_to(today) { described_class.preparation? } }
100+
101+
context "first day of 2024" do
102+
let(:today) { Date.new(2024, 9, 1) }
103+
104+
it { should be(false) }
105+
end
106+
107+
context "last day of only 2024" do
108+
let(:today) { Date.new(2025, 7, 31) }
109+
110+
it { should be(false) }
111+
end
112+
113+
context "preparing for 2025" do
114+
let(:today) { Date.new(2025, 8, 1) }
115+
116+
it { should be(true) }
117+
end
118+
119+
context "first day of 2025" do
120+
let(:today) { Date.new(2025, 9, 1) }
121+
122+
it { should be(false) }
123+
end
124+
end
73125
end

terraform/app/variables.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,10 @@ variable "app_version" {
164164
locals {
165165
is_production = var.environment == "production"
166166
parameter_store_variables = tomap({
167-
MAVIS__PDS__ENQUEUE_BULK_UPDATES = var.enable_pds_enqueue_bulk_updates ? "true" : "false"
168-
MAVIS__PDS__WAIT_BETWEEN_JOBS = 0.5
169-
GOOD_JOB_MAX_THREADS = 5
167+
MAVIS__PDS__ENQUEUE_BULK_UPDATES = var.enable_pds_enqueue_bulk_updates ? "true" : "false"
168+
MAVIS__PDS__WAIT_BETWEEN_JOBS = 0.5
169+
MAVIS__NUMBER_OF_PREPARATION_DAYS_BEFORE_ACADEMIC_YEAR_STARTS = 31
170+
GOOD_JOB_MAX_THREADS = 5
170171
})
171172
parameter_store_config_list = [for key, value in local.parameter_store_variables : {
172173
name = key

0 commit comments

Comments
 (0)