Skip to content

Commit a2314ff

Browse files
committed
Revert "Add needs_consent_no_contact_details status and supporting logic"
This reverts commit 3d555a7.
1 parent 35e8a25 commit a2314ff

9 files changed

Lines changed: 9 additions & 49 deletions

File tree

app/lib/patient_status_updater.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ def update_programme_statuses!
4848
:patient,
4949
:patient_locations,
5050
:triages,
51-
:vaccination_records,
52-
:parents
51+
:vaccination_records
5352
)
5453
.find_in_batches(batch_size: 10_000) do |batch|
5554
batch.each(&:assign)

app/lib/status_generator/programme.rb

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ def initialize(
1616
consents:,
1717
triages:,
1818
attendance_record:,
19-
vaccination_records:,
20-
parents:
19+
vaccination_records:
2120
)
2221
@programme_type = programme_type
2322
@academic_year = academic_year
@@ -26,8 +25,6 @@ def initialize(
2625
@consents = consents
2726
@triages = triages
2827
@attendance_record = attendance_record
29-
@vaccination_records = vaccination_records
30-
@parents = parents
3128

3229
@vaccination_criteria =
3330
VaccinationCriteria.new(
@@ -57,8 +54,6 @@ def status
5754
:cannot_vaccinate_absent
5855
elsif should_be_cannot_vaccinate_do_not_vaccinate?
5956
:cannot_vaccinate_do_not_vaccinate
60-
elsif should_be_needs_consent_no_contact_details?
61-
:needs_consent_no_contact_details
6257
elsif should_be_needs_consent_no_response?
6358
:needs_consent_no_response
6459
elsif should_be_cannot_vaccinate_delay_vaccination?
@@ -165,8 +160,7 @@ def consent_vaccine_methods
165160
:consents,
166161
:triages,
167162
:attendance_record,
168-
:vaccination_criteria,
169-
:parents
163+
:vaccination_criteria
170164

171165
delegate :vaccinated?,
172166
:vaccinated_vaccination_record,
@@ -238,12 +232,6 @@ def should_be_needs_consent_request_not_scheduled?
238232
false # TODO: Implement this status.
239233
end
240234

241-
def should_be_needs_consent_no_contact_details?
242-
is_eligible? && !parents_contactable?
243-
end
244-
245-
def parents_contactable? = parents.any?
246-
247235
def year_group = patient.year_group(academic_year:)
248236

249237
def is_eligible?

app/models/parent.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ class Parent < ApplicationRecord
6464
presence: true,
6565
if: :contact_method_other?
6666

67-
scope :contactable,
68-
-> { where.not(email: [nil, ""]).or(where.not(phone: [nil, ""])) }
69-
7067
def self.match_existing(patient:, email:, phone:, full_name:)
7168
if email.present? && (parent = Parent.find_by(email:))
7269
return parent

app/models/patient/programme_status.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ class Patient::ProgrammeStatus < ApplicationRecord
6363
through: :patient,
6464
source: :attendance_records
6565

66-
has_many :parents, -> { contactable }, through: :patient
67-
6866
GROUPS = %w[
6967
not_eligible
7068
needs_consent
@@ -82,8 +80,7 @@ class Patient::ProgrammeStatus < ApplicationRecord
8280
"needs_consent_request_scheduled" => 11,
8381
"needs_consent_request_failed" => 12,
8482
"needs_consent_no_response" => 13,
85-
"needs_consent_follow_up_requested" => 14,
86-
"needs_consent_no_contact_details" => 15
83+
"needs_consent_follow_up_requested" => 14
8784
}.freeze
8885

8986
HAS_REFUSAL_STATUSES = {
@@ -191,8 +188,7 @@ def generator
191188
consents:,
192189
triages:,
193190
attendance_record:,
194-
vaccination_records:,
195-
parents:
191+
vaccination_records:
196192
)
197193
end
198194
end

config/locales/status.en.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ en:
5757
needs_consent_request_failed: Needs consent
5858
needs_consent_request_not_scheduled: Needs consent
5959
needs_consent_request_scheduled: Needs consent
60-
needs_consent_no_contact_details: No contact details
6160
needs_triage: Needs triage
6261
not_eligible: Not eligible
6362
vaccinated: Vaccinated
@@ -85,7 +84,6 @@ en:
8584
needs_consent_request_failed: blue
8685
needs_consent_request_not_scheduled: blue
8786
needs_consent_request_scheduled: blue
88-
needs_consent_no_contact_details: blue
8987
needs_triage: blue
9088
not_eligible: grey
9189
vaccinated: white
@@ -105,7 +103,6 @@ en:
105103
needs_consent_request_failed: Request failed
106104
needs_consent_request_not_scheduled: Request not scheduled
107105
needs_consent_request_scheduled: Request scheduled
108-
needs_consent_no_contact_details: No contact details
109106
vaccinated_already: Already had the vaccine
110107
vaccinated_fully: Vaccinated
111108
registration:

spec/components/app_patient_programmes_table_component_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
end
4747

4848
context "when vaccinated last year" do
49-
let(:patient) { create(:patient, session:, parents: [create(:parent)]) }
49+
let(:patient) { create(:patient, session:) }
5050

5151
before do
5252
create(

spec/features/vaccination_programmes_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ def given_patients_exist_in_year_eleven
6969
year_group: 10,
7070
given_name: "John",
7171
family_name: "Smith",
72-
parents: [create(:parent)],
7372
school:
7473
)
7574

spec/lib/patient_programme_status_resolver_spec.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@
110110
let(:date_of_birth) { Date.new(2019, 12, 31) }
111111

112112
context "and eligible for 1st dose" do
113-
let(:patient) do
114-
create(:patient, date_of_birth:, session:, parents: [create(:parent)])
115-
end
113+
let(:patient) { create(:patient, date_of_birth:, session:) }
116114

117115
before do
118116
PatientStatusUpdater.call(patient:)

spec/lib/status_generator/programme_spec.rb

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@
1313
consents: patient.consents,
1414
triages: patient.triages,
1515
attendance_record: patient.attendance_records.first,
16-
vaccination_records: patient.vaccination_records.order_by_performed_at,
17-
parents: patient.parents.contactable
16+
vaccination_records: patient.vaccination_records.order_by_performed_at
1817
)
1918
end
2019

2120
let(:programme) { Programme.sample }
2221
let(:session) { create(:session, programmes: [programme]) }
23-
let(:patient) { create(:patient, session:, parents:) }
24-
let(:parents) { [create(:parent)] }
22+
let(:patient) { create(:patient, session:) }
2523
let(:location) { create(:school) }
2624

2725
context "when already vaccinated" do
@@ -370,18 +368,6 @@
370368
its(:vaccine_methods) { should be_nil }
371369
its(:without_gelatine) { should be_nil }
372370

373-
context "when there are no contact details for parents and no consent request has been sent" do
374-
let(:parents) { [create(:parent, :non_contactable)] }
375-
376-
its(:status) { should be(:needs_consent_no_contact_details) }
377-
end
378-
379-
context "when there are no parent relationships and no consent request has been sent" do
380-
let(:parents) { [] }
381-
382-
its(:status) { should be(:needs_consent_no_contact_details) }
383-
end
384-
385371
context "with a multi-dose programme" do
386372
let(:programme) { Programme.mmr }
387373

0 commit comments

Comments
 (0)