Skip to content

Commit 1049dde

Browse files
authored
Merge pull request #3744 from nhsuk/next
Version 2.2.7
2 parents 6c3ffb9 + a8868c5 commit 1049dde

Some content is hidden

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

54 files changed

+1207
-624
lines changed

.github/dependabot.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@
55

66
version: 2
77
updates:
8-
- package-ecosystem: "bundler"
9-
directory: "/"
8+
- package-ecosystem: bundler
9+
directory: /
10+
target-branch: next
1011
schedule:
11-
interval: "weekly"
12-
- package-ecosystem: "github-actions"
13-
directory: "/"
12+
interval: daily
13+
- package-ecosystem: github-actions
14+
directory: /
15+
target-branch: next
1416
schedule:
15-
interval: "weekly"
16-
- package-ecosystem: "npm"
17-
directory: "/"
17+
interval: daily
18+
- package-ecosystem: npm
19+
directory: /
20+
target-branch: next
1821
schedule:
19-
interval: "weekly"
22+
interval: daily

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ jobs:
103103
id: compare-permissions
104104
run: |
105105
source ./scripts/validate-github-actions-policy.sh
106-
validate_policies arn:aws:iam::${{ env.account_id }}:policy/DeployMavisResources ./resources/github_actions_policy.json
106+
validate_policies arn:aws:iam::${{ env.account_id }}:policy/DeployMavisResources ./account/resources/iam_policy_DeployMavisResources.json
107107
exit $?
108108
update-permissions:
109109
runs-on: ubuntu-latest
@@ -126,7 +126,7 @@ jobs:
126126
role-to-assume: arn:aws:iam::${{ env.account_id }}:role/GithubDeployMavisAndInfrastructure
127127
aws-region: eu-west-2
128128
- name: Update IAM policy
129-
run: ./scripts/update-github-actions-policy.sh arn:aws:iam::${{ env.account_id }}:policy/DeployMavisResources ./resources/github_actions_policy.json
129+
run: ./scripts/update-github-actions-policy.sh arn:aws:iam::${{ env.account_id }}:policy/DeployMavisResources ./account/resources/iam_policy_DeployMavisResources.json
130130
deploy-infrastructure:
131131
permissions:
132132
id-token: write

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ gem "stackprof"
2424
gem "activerecord-import"
2525
gem "activerecord-session_store"
2626
gem "amazing_print"
27+
gem "array_enum"
2728
gem "audited", git: "https://github.com/tvararu/audited", branch: "encryption"
2829
gem "caxlsx"
2930
gem "charlock_holmes"

Gemfile.lock

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,22 @@ GEM
100100
addressable (2.8.7)
101101
public_suffix (>= 2.0.2, < 7.0)
102102
aes_key_wrap (1.1.0)
103-
amazing_print (1.7.2)
103+
amazing_print (1.8.1)
104104
annotaterb (4.14.0)
105+
array_enum (1.6.0)
106+
activemodel
105107
asciidoctor (2.0.23)
106108
asciidoctor-diagram (3.0.0)
107109
asciidoctor (>= 1.5.7, < 3.x)
108110
rexml
109111
ast (2.4.3)
110112
attr_required (1.0.2)
111113
aws-eventstream (1.4.0)
112-
aws-partitions (1.1114.0)
114+
aws-partitions (1.1116.0)
113115
aws-sdk-accessanalyzer (1.72.0)
114116
aws-sdk-core (~> 3, >= 3.225.0)
115117
aws-sigv4 (~> 1.5)
116-
aws-sdk-core (3.225.1)
118+
aws-sdk-core (3.225.2)
117119
aws-eventstream (~> 1, >= 1.3.0)
118120
aws-partitions (~> 1, >= 1.992.0)
119121
aws-sigv4 (~> 1.9)
@@ -126,20 +128,20 @@ GEM
126128
aws-sdk-ecr (1.103.0)
127129
aws-sdk-core (~> 3, >= 3.225.0)
128130
aws-sigv4 (~> 1.5)
129-
aws-sdk-iam (1.120.0)
130-
aws-sdk-core (~> 3, >= 3.216.0)
131+
aws-sdk-iam (1.123.0)
132+
aws-sdk-core (~> 3, >= 3.225.0)
131133
aws-sigv4 (~> 1.5)
132134
aws-sdk-kms (1.101.0)
133135
aws-sdk-core (~> 3, >= 3.216.0)
134136
aws-sigv4 (~> 1.5)
135-
aws-sdk-rds (1.277.0)
136-
aws-sdk-core (~> 3, >= 3.216.0)
137+
aws-sdk-rds (1.280.0)
138+
aws-sdk-core (~> 3, >= 3.225.0)
137139
aws-sigv4 (~> 1.5)
138140
aws-sdk-s3 (1.186.0)
139141
aws-sdk-core (~> 3, >= 3.216.0)
140142
aws-sdk-kms (~> 1)
141143
aws-sigv4 (~> 1.5)
142-
aws-sigv4 (1.12.0)
144+
aws-sigv4 (1.12.1)
143145
aws-eventstream (~> 1, >= 1.0.2)
144146
backport (1.2.0)
145147
base64 (0.3.0)
@@ -575,7 +577,8 @@ GEM
575577
rubocop-rspec (3.5.0)
576578
lint_roller (~> 1.1)
577579
rubocop (~> 1.72, >= 1.72.1)
578-
ruby-prof (1.7.1)
580+
ruby-prof (1.7.2)
581+
base64
579582
ruby-progressbar (1.13.0)
580583
rubyXL (3.4.33)
581584
nokogiri (>= 1.10.8)
@@ -590,10 +593,10 @@ GEM
590593
securerandom (0.4.1)
591594
semantic_logger (4.16.1)
592595
concurrent-ruby (~> 1.0)
593-
sentry-rails (5.24.0)
596+
sentry-rails (5.25.0)
594597
railties (>= 5.0)
595-
sentry-ruby (~> 5.24.0)
596-
sentry-ruby (5.24.0)
598+
sentry-ruby (~> 5.25.0)
599+
sentry-ruby (5.25.0)
597600
bigdecimal
598601
concurrent-ruby (~> 1.0, >= 1.0.2)
599602
shoulda-matchers (6.5.0)
@@ -713,6 +716,7 @@ DEPENDENCIES
713716
activerecord-session_store
714717
amazing_print
715718
annotaterb
719+
array_enum
716720
asciidoctor
717721
asciidoctor-diagram
718722
audited!

app/controllers/api/organisations_controller.rb

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ def destroy
77
response.headers["Content-Type"] = "text/event-stream"
88
response.headers["Cache-Control"] = "no-cache"
99

10+
keep_itself = ActiveModel::Type::Boolean.new.cast(params[:keep_itself])
1011
organisation = Organisation.find_by!(ods_code: params[:ods_code])
1112

1213
@start_time = Time.zone.now
@@ -32,9 +33,6 @@ def destroy
3233
patient_sessions.in_batches { log_destroy(it) }
3334

3435
log_destroy(SessionDate.where(session: sessions))
35-
log_destroy(sessions)
36-
37-
organisation.patients
3836

3937
log_destroy(SchoolMove.where(patient_id: patient_ids))
4038
log_destroy(SchoolMove.where(organisation:))
@@ -62,7 +60,18 @@ def destroy
6260
VaccinationRecord.where(performed_ods_code: organisation.ods_code)
6361
)
6462

65-
UnscheduledSessionsFactory.new.call
63+
unless keep_itself
64+
log_destroy(SessionProgramme.where(session: sessions))
65+
log_destroy(sessions)
66+
67+
teams = Team.where(organisation:)
68+
Location.where(team: teams).update_all(team_id: nil)
69+
70+
log_destroy(teams)
71+
72+
log_destroy(OrganisationProgramme.where(organisation:))
73+
log_destroy(Organisation.where(id: organisation.id))
74+
end
6675
end
6776
end
6877

app/controllers/parent_interface/consent_forms/edit_controller.rb

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,23 @@ module ParentInterface
44
class ConsentForms::EditController < ConsentForms::BaseController
55
include WizardControllerConcern
66

7-
before_action :validate_params, only: %i[update]
7+
before_action :validate_params, only: :update
88
before_action :set_health_answer, if: :is_health_question_step?
9-
before_action :set_follow_up_changes_start_page, only: %i[show]
9+
before_action :set_follow_up_changes_start_page, only: :show
1010

1111
HOME_EDUCATED_SCHOOL_ID = "home-educated"
1212

1313
def show
14-
set_response if current_step == :consent
14+
case current_step
15+
when :response_doubles
16+
set_response_doubles
17+
when :response_flu
18+
set_response_flu
19+
when :response_hpv
20+
set_response_hpv
21+
when :injection_alternative
22+
set_injection_alternative
23+
end
1524

1625
render_wizard
1726
end
@@ -48,7 +57,9 @@ def update
4857
@consent_form.parent_phone.present?
4958
jump_to("contact-method", skip_to_confirm: true)
5059
end
51-
elsif current_step == :consent
60+
elsif current_step == :injection_alternative
61+
@consent_form.update_injection_alternative
62+
elsif is_response_step?
5263
@consent_form.update_programme_responses
5364
@consent_form.seed_health_questions
5465
end
@@ -97,9 +108,12 @@ def update_params
97108
parent_contact_method_type
98109
parent_contact_method_other_details
99110
],
100-
consent: %i[response chosen_programme],
101111
reason: %i[reason],
102112
reason_notes: %i[reason_notes],
113+
response_doubles: %i[response chosen_programme],
114+
response_flu: %i[response],
115+
response_hpv: %i[response],
116+
injection_alternative: %i[injection_alternative],
103117
address: %i[address_line_1 address_line_2 address_town address_postcode]
104118
}.fetch(current_step)
105119

@@ -125,18 +139,48 @@ def set_health_answer
125139
@health_answer = @consent_form.health_answers[@question_number]
126140
end
127141

128-
def set_response
142+
def set_response_doubles
129143
if @consent_form.response_given? && @consent_form.response_refused?
130144
@consent_form.response = "given_one"
131145
@consent_form.chosen_programme =
132-
@consent_form.given_programmes.first&.type
146+
@consent_form.given_programmes.first.type
133147
elsif @consent_form.response_given?
134148
@consent_form.response = "given"
135149
elsif @consent_form.response_refused?
136150
@consent_form.response = "refused"
137151
end
138152
end
139153

154+
def set_response_flu
155+
if @consent_form.response_given?
156+
method =
157+
@consent_form
158+
.given_consent_form_programmes
159+
.first
160+
.vaccine_methods
161+
.first
162+
@consent_form.response = "given_#{method}"
163+
elsif @consent_form.response_refused?
164+
@consent_form.response = "refused"
165+
end
166+
end
167+
168+
def set_response_hpv
169+
if @consent_form.response_given?
170+
@consent_form.response = "given"
171+
elsif @consent_form.response_refused?
172+
@consent_form.response = "refused"
173+
end
174+
end
175+
176+
def set_injection_alternative
177+
if @consent_form.consent_form_programmes.any?(
178+
&:vaccine_method_injection_and_nasal?
179+
)
180+
@consent_form.injection_alternative = "true"
181+
end
182+
end
183+
140184
def validate_params
141185
case current_step
142186
when :date_of_birth
@@ -154,9 +198,9 @@ def validate_params
154198
end
155199
end
156200

157-
def is_health_question_step?
158-
step == "health-question"
159-
end
201+
def is_response_step? = step.start_with?("response-")
202+
203+
def is_health_question_step? = step == "health-question"
160204

161205
def current_health_answer
162206
index = step.split("-").last.to_i - 1

app/controllers/patient_sessions/consents_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ def create_params
123123
{
124124
patient_session: @patient_session,
125125
programme: @programme,
126-
recorded_by: current_user
126+
recorded_by: current_user,
127+
vaccine_methods: %w[injection]
127128
}
128129
end
129130

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# frozen_string_literal: true
2+
3+
module HasVaccineMethods
4+
extend ActiveSupport::Concern
5+
6+
included do
7+
extend ArrayEnum
8+
9+
array_enum vaccine_methods: { injection: 0, nasal: 1 }
10+
11+
validates :vaccine_methods, subset: %w[injection nasal]
12+
end
13+
end

0 commit comments

Comments
 (0)