Skip to content

Commit 8ca47c8

Browse files
authored
Remove record_attendance feature flag (#2599)
The recording attendance feature is going to be part of the next release so we can remove the feature flag for it.
2 parents be59023 + d9dd4d5 commit 8ca47c8

17 files changed

+97
-45
lines changed

app/components/app_patient_page_component.html.erb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,6 @@
121121
<% end %>
122122
<% end %>
123123

124-
<% show_vaccination_form = helpers.policy(VaccinationRecord).create? %>
125-
<% show_vaccination_form &&= @patient_session.attending_today? if Flipper.enabled?(:record_attendance) %>
126-
127-
<% if show_vaccination_form %>
124+
<% if helpers.policy(VaccinationRecord).create? && @patient_session.attending_today? %>
128125
<%= render AppVaccinateFormComponent.new(@vaccination_record, section: @section, tab: @tab) %>
129126
<% end %>

app/views/patient_sessions/show.html.erb

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,25 @@
1010
<%= @patient.full_name %>
1111
<% end %>
1212

13-
<% if Flipper.enabled?(:record_attendance) %>
14-
<ul class="app-action-list">
15-
<li class="app-action-list__item">
16-
<% if @patient_session.current_attendance %>
17-
<% if @patient_session.current_attendance.attending? %>
18-
<%= govuk_tag(text: "Attending today’s session") %>
19-
<% else %>
20-
<%= govuk_tag(text: "Absent from today’s session", colour: "red") %>
21-
<% end %>
13+
<ul class="app-action-list">
14+
<li class="app-action-list__item">
15+
<% if @patient_session.current_attendance %>
16+
<% if @patient_session.current_attendance.attending? %>
17+
<%= govuk_tag(text: "Attending today’s session") %>
2218
<% else %>
23-
<%= govuk_tag(text: "Not registered yet", colour: "blue") %>
19+
<%= govuk_tag(text: "Absent from today’s session", colour: "red") %>
2420
<% end %>
25-
</li>
26-
<li class="app-action-list__item">
27-
<%= link_to(
28-
"Update attendance",
29-
edit_session_patient_attendance_path(patient_id: @patient.id)
30-
) %>
31-
</li>
32-
</ul>
33-
<% end %>
21+
<% else %>
22+
<%= govuk_tag(text: "Not registered yet", colour: "blue") %>
23+
<% end %>
24+
</li>
25+
<li class="app-action-list__item">
26+
<%= link_to(
27+
"Update attendance",
28+
edit_session_patient_attendance_path(patient_id: @patient.id)
29+
) %>
30+
</li>
31+
</ul>
3432

3533
<%= render AppSecondaryNavigationComponent.new do |nav|
3634
nav.with_item(

app/views/sessions/show.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<% end %>
6868
</li>
6969

70-
<% if Flipper.enabled?(:record_attendance) && @session.today? %>
70+
<% if @session.today? %>
7171
<li class="nhsuk-grid-column-full nhsuk-card-group__item">
7272
<%= render AppCardComponent.new(link_to: session_attendances_path(@session)) do |c| %>
7373
<% c.with_heading { "Register attendance" } %>

config/locales/en.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,7 @@ en:
849849
index:
850850
title: Vaccines
851851
attendance_flash:
852+
absent: "%{name} is absent from today’s session."
852853
added_to_session: "%{name} is attending today’s session. They still need consent to vaccinate."
853854
consent_conflicts: "%{name} is attending today’s session. They still need consent to vaccinate."
854855
consent_given_triage_needed: "%{name} is attending today’s session. A nurse needs to triage their record."
@@ -857,9 +858,9 @@ en:
857858
delay_vaccination: "%{name} needs to leave the session because their vaccination is delayed to a later date."
858859
triaged_do_not_vaccinate: "%{name} needs to leave the session because their parent or guardian refused to give consent."
859860
triaged_kept_in_triage: "%{name} is attending today’s session. A nurse needs to triage their record."
861+
triaged_ready_to_vaccinate: "%{name} is attending today’s session. They are safe to vaccinate."
860862
unable_to_vaccinate: "%{name} needs to leave the session because they cannot be vaccinated."
861863
vaccinated: "%{name} needs to leave the session because they have already been vaccinated."
862-
absent: "%{name} is absent from today’s session."
863864
wicked:
864865
address: address
865866
agree: agree

spec/components/app_patient_page_component_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
:patient_session,
9999
:triaged_ready_to_vaccinate,
100100
:session_in_progress,
101+
:in_attendance,
101102
programme:
102103
)
103104
end

spec/factories/patient_sessions.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
association :patient, organisation:, school:, home_educated:, year_group:
3535
end
3636

37+
trait :in_attendance do
38+
session_attendances do
39+
[association(:session_attendance, :present, patient_session: instance)]
40+
end
41+
end
42+
3743
trait :added_to_session
3844

3945
trait :consent_given_triage_not_needed do

spec/factories/patients.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
end
6363
year_group { nil }
6464
location_name { nil }
65+
in_attendance { false }
6566
end
6667

6768
cohort do
@@ -107,14 +108,25 @@
107108

108109
after(:create) do |patient, evaluator|
109110
if evaluator.session
110-
patient.patient_sessions.find_or_create_by!(session: evaluator.session)
111+
patient_session =
112+
patient.patient_sessions.find_or_create_by!(
113+
session: evaluator.session
114+
)
115+
116+
if evaluator.in_attendance
117+
create(:session_attendance, :present, patient_session:)
118+
end
111119
end
112120

113121
evaluator.parents.each do |parent|
114122
create(:parent_relationship, parent:, patient:)
115123
end
116124
end
117125

126+
trait :in_attendance do
127+
in_attendance { true }
128+
end
129+
118130
trait :home_educated do
119131
school { nil }
120132
home_educated { true }

spec/features/e2e_journey_spec.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
when_i_register_verbal_consent_and_triage
2727
then_i_should_see_that_the_patient_is_ready_for_vaccination
2828

29+
# Attendance
30+
when_i_click_on_the_register_attendance_section
31+
and_i_record_the_patient_in_attendance
32+
2933
# Vaccination
3034
when_i_click_on_the_vaccination_section
3135
and_i_record_the_successful_vaccination
@@ -207,9 +211,18 @@ def then_i_should_see_that_the_patient_is_ready_for_vaccination
207211
expect(page).to have_content "Safe to vaccinate"
208212
end
209213

210-
def when_i_click_on_the_vaccination_section
214+
def when_i_click_on_the_register_attendance_section
211215
click_link "Back to consents page"
212216
click_link "Pilot School"
217+
click_link "Register attendance"
218+
end
219+
220+
def and_i_record_the_patient_in_attendance
221+
click_on "Attending"
222+
end
223+
224+
def when_i_click_on_the_vaccination_section
225+
click_link "Back"
213226
click_link "Record vaccinations"
214227
click_link "Vaccinate ( 1 )"
215228
end

spec/features/hpv_vaccination_administered_spec.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ def given_i_am_signed_in
7777

7878
@session = create(:session, organisation:, programme:, location:)
7979
@patient =
80-
create(:patient, :consent_given_triage_not_needed, session: @session)
80+
create(
81+
:patient,
82+
:consent_given_triage_not_needed,
83+
:in_attendance,
84+
session: @session
85+
)
8186

8287
sign_in organisation.users.first
8388
end

spec/features/hpv_vaccination_already_had_spec.rb

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

33
describe "HPV Vaccination" do
4-
scenario "Not administered" do
4+
scenario "Already had" do
55
given_i_am_signed_in
66

77
when_i_go_to_a_patient_that_is_ready_to_vaccinate
@@ -33,7 +33,12 @@ def given_i_am_signed_in
3333
@batch = create(:batch, organisation:, vaccine: programme.vaccines.first)
3434
@session = create(:session, organisation:, programme:, location:)
3535
@patient =
36-
create(:patient, :consent_given_triage_not_needed, session: @session)
36+
create(
37+
:patient,
38+
:consent_given_triage_not_needed,
39+
:in_attendance,
40+
session: @session
41+
)
3742

3843
sign_in organisation.users.first
3944
end

0 commit comments

Comments
 (0)