Skip to content

Commit ce082fa

Browse files
authored
Merge pull request #5183 from nhsuk/next
Version 5.7.0
2 parents 4133714 + ec8ab80 commit ce082fa

File tree

69 files changed

+740
-472
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+740
-472
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ jobs:
5858
ports:
5959
- 5432:5432
6060
env:
61-
DATABASE_URL: postgres://postgres:postgres@localhost:5432/manage_vaccinations_test
6261
RAILS_ENV: test
62+
DATABASE_HOST: localhost
63+
DATABASE_USER: postgres
64+
DATABASE_PASSWORD: postgres
6365
steps:
6466
- uses: actions/checkout@v5
6567
- uses: actions/setup-node@v6
@@ -69,12 +71,14 @@ jobs:
6971
- uses: ruby/setup-ruby@v1
7072
with:
7173
bundler-cache: true
72-
- name: Setup database
73-
run: bin/rails db:test:prepare
74+
- name: Setup Database
75+
run: |
76+
bin/rails parallel:create
77+
bin/rails parallel:load_schema
7478
- name: Precompile assets
7579
run: bin/rails assets:precompile
7680
- name: Run rspec
77-
run: bundle exec rspec spec
81+
run: bin/rails parallel:spec
7882

7983
jest:
8084
name: Jest

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ group :development, :test do
7777
gem "brakeman", require: false
7878
gem "debug", platforms: %i[mri windows]
7979
gem "factory_bot_instruments"
80+
gem "parallel_tests"
8081
gem "pry-rails"
8182
gem "rspec-rails"
8283
end

Gemfile.lock

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,30 +119,30 @@ GEM
119119
aws-sdk-accessanalyzer (1.81.0)
120120
aws-sdk-core (~> 3, >= 3.234.0)
121121
aws-sigv4 (~> 1.5)
122-
aws-sdk-core (3.236.0)
122+
aws-sdk-core (3.237.0)
123123
aws-eventstream (~> 1, >= 1.3.0)
124124
aws-partitions (~> 1, >= 1.992.0)
125125
aws-sigv4 (~> 1.9)
126126
base64
127127
bigdecimal
128128
jmespath (~> 1, >= 1.6.1)
129129
logger
130-
aws-sdk-ec2 (1.571.0)
130+
aws-sdk-ec2 (1.574.0)
131131
aws-sdk-core (~> 3, >= 3.234.0)
132132
aws-sigv4 (~> 1.5)
133133
aws-sdk-ecr (1.112.0)
134134
aws-sdk-core (~> 3, >= 3.234.0)
135135
aws-sigv4 (~> 1.5)
136-
aws-sdk-iam (1.132.0)
136+
aws-sdk-iam (1.133.0)
137137
aws-sdk-core (~> 3, >= 3.234.0)
138138
aws-sigv4 (~> 1.5)
139-
aws-sdk-kms (1.116.0)
139+
aws-sdk-kms (1.117.0)
140140
aws-sdk-core (~> 3, >= 3.234.0)
141141
aws-sigv4 (~> 1.5)
142142
aws-sdk-rds (1.297.0)
143143
aws-sdk-core (~> 3, >= 3.234.0)
144144
aws-sigv4 (~> 1.5)
145-
aws-sdk-s3 (1.203.0)
145+
aws-sdk-s3 (1.203.1)
146146
aws-sdk-core (~> 3, >= 3.234.0)
147147
aws-sdk-kms (~> 1)
148148
aws-sigv4 (~> 1.5)
@@ -433,6 +433,8 @@ GEM
433433
pagy (9.4.0)
434434
paint (2.3.0)
435435
parallel (1.27.0)
436+
parallel_tests (5.5.0)
437+
parallel
436438
parser (3.3.10.0)
437439
ast (~> 2.4.1)
438440
racc
@@ -832,6 +834,7 @@ DEPENDENCIES
832834
omniauth-rails_csrf_protection
833835
omniauth_openid_connect
834836
pagy
837+
parallel_tests
835838
pg
836839
phonelib
837840
prettier_print

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,15 @@ To run the Rails tests:
189189
bin/bundle exec rspec
190190
```
191191

192+
or run them in parallel using the `parallel_tests` gem
193+
194+
```shell
195+
# Setup
196+
rake parallel:create parallel:prepare
197+
198+
rake parallel:spec
199+
```
200+
192201
To run the JS unit tests:
193202

194203
```shell

app/components/app_patient_session_search_result_card_component.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ def attached_tags(context)
234234
hash[programme.name] = PatientStatusResolver.new(
235235
patient,
236236
programme:,
237-
academic_year:
237+
academic_year:,
238+
context_location_id: session.location_id
238239
).send(context)
239240
end
240241
end

app/components/app_patient_session_section_component.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ def colour = resolved_status.fetch(:colour)
1818
def heading = "#{programme.name}: #{resolved_status.fetch(:text)}"
1919

2020
def patient_status_resolver
21-
PatientStatusResolver.new(patient, programme:, academic_year:)
21+
PatientStatusResolver.new(
22+
patient,
23+
programme:,
24+
academic_year:,
25+
context_location_id: session.location_id
26+
)
2227
end
2328
end

app/components/app_session_actions_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def ready_for_vaccinator_row
108108
session.programmes.index_with do |programme|
109109
patients
110110
.has_registration_status(%w[attending completed], session:)
111-
.includes(:consent_statuses, :triage_statuses, :vaccination_statuses)
111+
.includes_statuses
112112
.count do |patient|
113113
patient.consent_given_and_safe_to_vaccinate?(
114114
programme:,

app/components/app_session_overview_tallies_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def eligible_children_count(programme)
9999
def still_to_vaccinate_count
100100
session
101101
.patients
102-
.includes(:consent_statuses, :triage_statuses, :vaccination_statuses)
102+
.includes_statuses
103103
.consent_given_and_safe_to_vaccinate(
104104
programmes:,
105105
academic_year:,

app/controllers/api/testing/teams_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ def destroy
7575

7676
log_destroy(ParentRelationship.where(patient_id: patient_ids))
7777
log_destroy(Patient.where(id: patient_ids))
78+
79+
log_destroy(
80+
Consent.where(parent: Parent.where.missing(:parent_relationships))
81+
)
7882
log_destroy(Parent.where.missing(:parent_relationships))
7983

8084
log_destroy(

app/controllers/patient_sessions/base_controller.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ def set_academic_year
3131

3232
def set_patient
3333
@patient =
34-
policy_scope(Patient).includes(parent_relationships: :parent).find(
35-
params.fetch(:patient_id, params[:id])
36-
)
34+
policy_scope(Patient)
35+
.includes_statuses
36+
.includes(parent_relationships: :parent)
37+
.find(params.fetch(:patient_id, params[:id]))
3738
end
3839

3940
def set_patient_location

0 commit comments

Comments
 (0)