Skip to content

Commit 905f5f9

Browse files
authored
Rename none outcome statuses (#3229)
2 parents 37a126b + a069fb7 commit 905f5f9

15 files changed

+44
-42
lines changed

app/components/app_consent_component.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<%= render AppConsentStatusComponent.new(patient_session:, programme:) %>
22

3-
<% if patient.consent_outcome.none?(programme) %>
3+
<% if patient.consent_outcome.no_response?(programme) %>
44
<% if latest_consent_request %>
55
<p class="nhsuk-body">
66
No-one responded to our requests for consent.

app/components/app_consent_component.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ def latest_consent_request
2828
end
2929

3030
def can_send_consent_request?
31-
patient.consent_outcome.none?(programme) && patient.send_notifications? &&
32-
session.open_for_consent? && patient.parents.any?
31+
patient.consent_outcome.no_response?(programme) &&
32+
patient.send_notifications? && session.open_for_consent? &&
33+
patient.parents.any?
3334
end
3435

3536
def status_colour(consent)

app/components/app_programme_session_table_component.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ def percentage_stat(session:)
3030
end
3131

3232
def no_response_count(session:)
33-
number_stat(session:) { it.patient.consent_outcome.none?(programme) }
33+
number_stat(session:) { it.patient.consent_outcome.no_response?(programme) }
3434
end
3535

3636
def no_response_percentage(session:)
37-
percentage_stat(session:) { it.patient.consent_outcome.none?(programme) }
37+
percentage_stat(session:) do
38+
it.patient.consent_outcome.no_response?(programme)
39+
end
3840
end
3941

4042
def triage_needed_count(session:)

app/components/app_session_actions_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def rows
3434
def no_consent_response_row
3535
consent_row(
3636
text: "No consent response",
37-
status: Patient::ConsentOutcome::NONE
37+
status: Patient::ConsentOutcome::NO_RESPONSE
3838
)
3939
end
4040

app/controllers/consents_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def create
2626
end
2727

2828
def send_request
29-
return unless @patient.consent_outcome.none?(@programme)
29+
return unless @patient.consent_outcome.no_response?(@programme)
3030

3131
# For programmes that are administered together we should send the consent request together.
3232
programmes =

app/models/patient/consent_outcome.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ def initialize(patient)
66
end
77

88
STATUSES = [
9-
NONE = :none,
9+
NO_RESPONSE = :no_response,
1010
CONFLICTS = :conflicts,
1111
GIVEN = :given,
1212
REFUSED = :refused
1313
].freeze
1414

15-
def given?(programme) = status[programme] == GIVEN
16-
17-
def refused?(programme) = status[programme] == REFUSED
15+
def no_response?(programme) = status[programme] == NO_RESPONSE
1816

1917
def conflicts?(programme) = status[programme] == CONFLICTS
2018

21-
def none?(programme) = status[programme] == NONE
19+
def given?(programme) = status[programme] == GIVEN
20+
21+
def refused?(programme) = status[programme] == REFUSED
2222

2323
def status
2424
@status ||=
@@ -57,7 +57,7 @@ def programme_status(programme)
5757
elsif consent_conflicts?(programme)
5858
CONFLICTS
5959
else
60-
NONE
60+
NO_RESPONSE
6161
end
6262
end
6363

app/models/patient/next_activity.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ def status_for_programme(programme)
3737

3838
return TRIAGE if triage_outcome.required?(programme)
3939

40-
if consent_outcome.none?(programme) || consent_outcome.conflicts?(programme)
40+
if consent_outcome.no_response?(programme) ||
41+
consent_outcome.conflicts?(programme)
4142
return CONSENT
4243
end
4344

app/models/patient/programme_outcome.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ def initialize(patient)
88
STATUSES = [
99
VACCINATED = :vaccinated,
1010
COULD_NOT_VACCINATE = :could_not_vaccinate,
11-
NONE = :none
11+
NONE_YET = :none_yet
1212
].freeze
1313

1414
def vaccinated?(programme) = status[programme] == VACCINATED
1515

1616
def could_not_vaccinate?(programme) = status[programme] == COULD_NOT_VACCINATE
1717

18-
def none?(programme) = status[programme] == NONE
18+
def none_yet?(programme) = status[programme] == NONE_YET
1919

2020
def status
2121
@status ||=
@@ -43,7 +43,7 @@ def programme_status(programme)
4343
elsif programme_could_not_vaccinate?(programme)
4444
COULD_NOT_VACCINATE
4545
else
46-
NONE
46+
NONE_YET
4747
end
4848
end
4949

app/models/patient_session.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def destroy_if_safe!
109109
end
110110

111111
def can_record_as_already_vaccinated?(programme:)
112-
!session.today? && patient.programme_outcome.none?(programme)
112+
!session.today? && patient.programme_outcome.none_yet?(programme)
113113
end
114114

115115
def programmes
@@ -143,10 +143,10 @@ def ready_for_vaccinator?(programme: nil)
143143
def outstanding_programmes
144144
# If this patient hasn't been seen yet by a nurse for any of the programmes,
145145
# we don't want to show the banner.
146-
return [] if programmes.all? { session_outcome.none?(it) }
146+
return [] if programmes.all? { session_outcome.none_yet?(it) }
147147

148148
programmes.select do
149-
ready_for_vaccinator?(programme: it) && session_outcome.none?(it)
149+
ready_for_vaccinator?(programme: it) && session_outcome.none_yet?(it)
150150
end
151151
end
152152
end

app/models/patient_session/register_outcome.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ def session_date
5656
end
5757

5858
def all_programmes_have_outcome?
59-
programmes.none? { session_outcome.none?(it) }
59+
programmes.none? { session_outcome.none_yet?(it) }
6060
end
6161
end

0 commit comments

Comments
 (0)