Skip to content

Commit 979140d

Browse files
authored
Changes for 1.5.0 (#2962)
The plan is to deploy 1.4.0 to production on Monday (17th), so we're in a position where we can get the changes for 1.5.0 ready to merge in to `main`. This branch represents all the work that was done for 1.5.0 (also visible using [the milestone](https://github.com/nhsuk/manage-vaccinations-in-schools/milestone/5?closed=1)) which was necessary as we hadn't yet deployed the previous release and wants to leave `main` open for any last minute fixes that needed to be added to 1.4.0.
2 parents 76223e2 + 64286eb commit 979140d

File tree

196 files changed

+2051
-2519
lines changed

Some content is hidden

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

196 files changed

+2051
-2519
lines changed

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ gem "govuk_design_system_formbuilder"
4343
gem "govuk_markdown"
4444
gem "jsonb_accessor"
4545
gem "jwt"
46-
gem "mail-notify"
4746
gem "notifications-ruby-client"
4847
gem "okcomputer"
4948
gem "omniauth_openid_connect"

Gemfile.lock

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,15 @@ GEM
116116
ast (2.4.2)
117117
attr_required (1.0.2)
118118
aws-eventstream (1.3.0)
119-
aws-partitions (1.1044.0)
119+
aws-partitions (1.1049.0)
120120
aws-sdk-accessanalyzer (1.65.0)
121121
aws-sdk-core (~> 3, >= 3.216.0)
122122
aws-sigv4 (~> 1.5)
123-
aws-sdk-core (3.217.1)
123+
aws-sdk-core (3.218.1)
124124
aws-eventstream (~> 1, >= 1.3.0)
125125
aws-partitions (~> 1, >= 1.992.0)
126126
aws-sigv4 (~> 1.9)
127+
base64
127128
jmespath (~> 1, >= 1.6.1)
128129
aws-sdk-ec2 (1.503.0)
129130
aws-sdk-core (~> 3, >= 3.216.0)
@@ -137,8 +138,8 @@ GEM
137138
aws-sdk-kms (1.97.0)
138139
aws-sdk-core (~> 3, >= 3.216.0)
139140
aws-sigv4 (~> 1.5)
140-
aws-sdk-rds (1.264.0)
141-
aws-sdk-core (~> 3, >= 3.210.0)
141+
aws-sdk-rds (1.269.0)
142+
aws-sdk-core (~> 3, >= 3.216.0)
142143
aws-sigv4 (~> 1.5)
143144
aws-sdk-s3 (1.178.0)
144145
aws-sdk-core (~> 3, >= 3.216.0)
@@ -281,7 +282,7 @@ GEM
281282
temple (>= 0.8.2)
282283
thor
283284
tilt
284-
hashdiff (1.1.1)
285+
hashdiff (1.1.2)
285286
hashie (5.0.0)
286287
hotwire-livereload (2.0.0)
287288
actioncable (>= 7.0.0)
@@ -339,13 +340,6 @@ GEM
339340
net-imap
340341
net-pop
341342
net-smtp
342-
mail-notify (2.0.0)
343-
actionmailer (>= 5.2.8.1)
344-
actionpack (>= 5.2.8.1)
345-
actionview (>= 5.2.8.1)
346-
activesupport (>= 5.2.8.1)
347-
notifications-ruby-client (~> 6.0)
348-
rack (>= 2.1.4.1)
349343
marcel (1.0.4)
350344
matrix (0.4.2)
351345
mechanize (2.14.0)
@@ -375,7 +369,7 @@ GEM
375369
net-http-digest_auth (1.4.1)
376370
net-http-persistent (4.0.5)
377371
connection_pool (~> 2.2)
378-
net-imap (0.5.2)
372+
net-imap (0.5.6)
379373
date
380374
net-protocol
381375
net-pop (0.1.2)
@@ -424,7 +418,7 @@ GEM
424418
ast (~> 2.4.1)
425419
racc
426420
pg (1.5.9)
427-
phonelib (0.10.3)
421+
phonelib (0.10.4)
428422
pp (0.6.2)
429423
prettyprint
430424
prettier_print (1.2.1)
@@ -518,7 +512,7 @@ GEM
518512
railties (>= 5.2)
519513
reverse_markdown (2.1.1)
520514
nokogiri
521-
rexml (3.3.9)
515+
rexml (3.4.0)
522516
rladr (1.2.0)
523517
rspec (3.13.0)
524518
rspec-core (~> 3.13.0)
@@ -622,7 +616,7 @@ GEM
622616
activesupport
623617
solargraph
624618
splunk-sdk-ruby (1.0.5)
625-
stackprof (0.2.26)
619+
stackprof (0.2.27)
626620
stimulus-rails (1.3.4)
627621
railties (>= 6.0.0)
628622
stringio (3.1.2)
@@ -676,7 +670,7 @@ GEM
676670
activesupport
677671
faraday (~> 2.0)
678672
faraday-follow_redirects
679-
webmock (3.24.0)
673+
webmock (3.25.0)
680674
addressable (>= 2.8.0)
681675
crack (>= 0.3.2)
682676
hashdiff (>= 0.4.0, < 2.0.0)
@@ -746,7 +740,6 @@ DEPENDENCIES
746740
jsbundling-rails
747741
jsonb_accessor
748742
jwt
749-
mail-notify
750743
mechanize
751744
notifications-ruby-client
752745
okcomputer

app/components/app_activity_log_component.rb

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,39 @@ def initialize(patient: nil, patient_session: nil)
2828
patient_session ? [patient_session] : patient.patient_sessions
2929

3030
@consents =
31-
(patient || patient_session).consents.includes(
31+
@patient.consents.includes(
3232
:consent_form,
3333
:parent,
3434
:recorded_by,
3535
patient: :parent_relationships
3636
)
37+
3738
@gillick_assessments =
3839
(patient || patient_session).gillick_assessments.includes(:performed_by)
40+
3941
@notify_log_entries = @patient.notify_log_entries.includes(:sent_by)
42+
4043
@pre_screenings =
4144
(patient || patient_session).pre_screenings.includes(:performed_by)
45+
4246
@session_attendances =
4347
(patient || patient_session).session_attendances.includes(:location)
44-
@triages = (patient || patient_session).triages.includes(:performed_by)
48+
49+
@triages = @patient.triages.includes(:performed_by)
50+
4551
@vaccination_records =
46-
(patient || patient_session).vaccination_records.with_discarded.includes(
52+
@patient.vaccination_records.with_discarded.includes(
4753
:performed_by_user,
4854
:programme,
4955
:vaccine
5056
)
57+
58+
if (programme = patient_session&.programmes&.first) # TODO: handle multiple programmes
59+
@consents = @consents.where(programme:)
60+
@gillick_assessments = @gillick_assessments.where(programme:)
61+
@triages = @triages.where(programme:)
62+
@vaccination_records = @vaccination_records.where(programme:)
63+
end
5164
end
5265

5366
attr_reader :patient,
@@ -150,7 +163,7 @@ def notify_events
150163
notify_log_entries.map do
151164
{
152165
title: "#{_1.title} sent",
153-
body: patient.restricted? ? "" : _1.recipient,
166+
body: patient.restricted? ? "" : _1.recipient_deterministic,
154167
at: _1.created_at,
155168
by: _1.sent_by
156169
}

app/components/app_consent_component.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ def initialize(patient_session:, section:, tab:)
1414
delegate :patient, to: :patient_session
1515
delegate :session, to: :patient_session
1616

17+
def programme
18+
patient_session.programmes.first # TODO: handle multiple programmes
19+
end
20+
1721
def consents
18-
@consents ||= patient_session.consents.sort_by(&:created_at).reverse
22+
@consents ||=
23+
patient_session.consents(programme:).sort_by(&:created_at).reverse
1924
end
2025

2126
def latest_consent_request

app/components/app_import_format_details_component.rb

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# frozen_string_literal: true
22

33
class AppImportFormatDetailsComponent < ViewComponent::Base
4-
def initialize(import:, programme: nil)
4+
def initialize(import:)
55
super
66

77
@import = import
8-
@programme = programme
98
end
109

1110
private
1211

12+
delegate :organisation, to: :@import
13+
1314
def summary_text
1415
case @import
1516
when ClassImport
@@ -86,7 +87,9 @@ def immunisation_import_columns
8687
{ name: "PERSON_SURNAME", notes: tag.strong("Required") },
8788
{
8889
name: "PERSON_DOB",
89-
notes: "#{tag.strong("Required")}, must use #{tag.i("YYYYMMDD")} format"
90+
notes:
91+
"#{tag.strong("Required")}, must use either #{tag.i("YYYYMMDD")} or " \
92+
"#{tag.i("DD/MM/YYYY")} format"
9093
},
9194
{
9295
name: "PERSON_GENDER_CODE",
@@ -101,7 +104,9 @@ def immunisation_import_columns
101104
},
102105
{
103106
name: "DATE_OF_VACCINATION",
104-
notes: "#{tag.strong("Required")}, must use #{tag.i("YYYYMMDD")} format"
107+
notes:
108+
"#{tag.strong("Required")}, must use either #{tag.i("YYYYMMDD")} or " \
109+
"#{tag.i("DD/MM/YYYY")} format"
105110
},
106111
{
107112
name: "TIME_OF_VACCINATION",
@@ -110,8 +115,8 @@ def immunisation_import_columns
110115
{
111116
name: "VACCINE_GIVEN",
112117
notes:
113-
"Required if #{tag.code("VACCINATED")} is #{tag.i("Y")}, must be " +
114-
@programme
118+
"#{tag.strong("Required")}, must be " +
119+
organisation
115120
.vaccines
116121
.pluck(:nivs_name)
117122
.map { tag.i(_1) }
@@ -127,7 +132,8 @@ def immunisation_import_columns
127132
{
128133
name: "BATCH_EXPIRY_DATE",
129134
notes:
130-
"Required if #{tag.code("VACCINATED")} is #{tag.i("Y")}, must use #{tag.i("YYYYMMDD")} format"
135+
"Required if #{tag.code("VACCINATED")} is #{tag.i("Y")}, must use " \
136+
"either #{tag.i("YYYYMMDD")} or #{tag.i("DD/MM/YYYY")} format"
131137
},
132138
{
133139
name: "VACCINATED",
@@ -239,8 +245,6 @@ def anatomical_site
239245
end
240246

241247
def dose_sequence
242-
return [] unless @programme.hpv?
243-
244248
[
245249
{
246250
name: "DOSE_SEQUENCE",

app/components/app_imports_table_component.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<% row.with_cell do %>
2323
<span class="nhsuk-table-responsive__heading">Imported on</span>
2424
<%= govuk_link_to import.created_at.to_fs(:long),
25-
path(programme, import) %>
25+
path(import) %>
2626
<% end %>
2727
<% row.with_cell do %>
2828
<span class="nhsuk-table-responsive__heading">Imported by</span>

app/components/app_imports_table_component.rb

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# frozen_string_literal: true
22

33
class AppImportsTableComponent < ViewComponent::Base
4-
def initialize(organisation:, programme:)
4+
def initialize(organisation:)
55
super
66

77
@organisation = organisation
8-
@programme = programme
98
end
109

1110
def render?
@@ -14,7 +13,7 @@ def render?
1413

1514
private
1615

17-
attr_reader :organisation, :programme
16+
attr_reader :organisation
1817

1918
def imports
2019
@imports ||=
@@ -27,7 +26,7 @@ def imports
2726
def class_import_records
2827
ClassImport
2928
.select("class_imports.*", "COUNT(patients.id) AS record_count")
30-
.where(organisation:, session: programme.sessions)
29+
.where(organisation:)
3130
.left_outer_joins(:patients)
3231
.includes(:uploaded_by, session: :location)
3332
.group("class_imports.id")
@@ -36,7 +35,7 @@ def class_import_records
3635
def cohort_import_records
3736
CohortImport
3837
.select("cohort_imports.*", "COUNT(patients.id) AS record_count")
39-
.where(organisation:, programme:)
38+
.where(organisation:)
4039
.left_outer_joins(:patients)
4140
.includes(:uploaded_by)
4241
.group("cohort_imports.id")
@@ -48,19 +47,19 @@ def immunisation_import_records
4847
"immunisation_imports.*",
4948
"COUNT(vaccination_records.id) AS record_count"
5049
)
51-
.where(organisation:, programme:)
50+
.where(organisation:)
5251
.left_outer_joins(:vaccination_records)
5352
.includes(:uploaded_by)
5453
.group("immunisation_imports.id")
5554
end
5655

57-
def path(programme, import)
56+
def path(import)
5857
if import.is_a?(ClassImport)
5958
session_class_import_path(import.session, import)
6059
elsif import.is_a?(CohortImport)
61-
programme_cohort_import_path(programme, import)
60+
cohort_import_path(import)
6261
else
63-
programme_immunisation_import_path(programme, import)
62+
immunisation_import_path(import)
6463
end
6564
end
6665

app/components/app_outcome_banner_component.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,14 @@ def rows
4848

4949
def vaccination_record
5050
@vaccination_record ||=
51-
if @patient_session.vaccinated?
52-
@patient_session
53-
.vaccination_records
54-
.select(&:administered?)
55-
.max_by(&:created_at)
56-
else
57-
@patient_session.latest_vaccination_record
58-
end
51+
@patient_session
52+
.vaccination_records(programme:)
53+
.then { @patient_session.vaccinated? ? it.select(&:administered?) : it }
54+
.last
5955
end
6056

6157
def triage
62-
@triage ||= @patient_session.latest_triage
58+
@triage ||= @patient_session.latest_triage(programme:)
6359
end
6460

6561
def show_location?
@@ -126,4 +122,8 @@ def heading
126122
def colour
127123
I18n.t("patient_session_statuses.#{status}.colour")
128124
end
125+
126+
def programme
127+
@patient_session.programmes.first # TODO: handle multiple programmes
128+
end
129129
end

app/components/app_patient_cohort_table_component.html.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<% if cohort %>
1+
<% if organisation %>
22
<%= govuk_table(html_attributes: {
33
class: "nhsuk-table-responsive",
44
}) do |table| %>
@@ -13,12 +13,12 @@
1313
<% body.with_row do |row| %>
1414
<% row.with_cell do %>
1515
<span class="nhsuk-table-responsive__heading">Name</span>
16-
<%= helpers.format_year_group(cohort.year_group) %>
16+
<%= helpers.format_year_group(year_group) %>
1717
<% end %>
1818
<% row.with_cell do %>
1919
<span class="nhsuk-table-responsive__heading">Actions</span>
2020
<%= form_with model: @patient, builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %>
21-
<%= f.hidden_field :cohort_id, value: "" %>
21+
<%= f.hidden_field :organisation_id, value: "" %>
2222
<%= f.govuk_submit "Remove from cohort", class: "app-button--secondary-warning app-button--small" %>
2323
<% end %>
2424
<% end %>

app/components/app_patient_cohort_table_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ def initialize(patient)
1111

1212
attr_reader :patient
1313

14-
delegate :cohort, to: :patient
14+
delegate :organisation, :year_group, to: :patient
1515
end

0 commit comments

Comments
 (0)