Skip to content

Commit 916c4fc

Browse files
committed
Add Programme activity card
This adds a programme specific activity log to each programme tab. Jira-Issue: MAV-3838
1 parent b19e780 commit 916c4fc

4 files changed

Lines changed: 47 additions & 12 deletions

File tree

app/components/app_patient_navigation_component.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def call
1616
text: "Child record",
1717
selected: active == :show
1818
)
19+
1920
if Flipper.enabled?(:child_record_redesign)
2021
@programmes.flat_map do |programme|
2122
nav.with_item(
@@ -25,11 +26,14 @@ def call
2526
)
2627
end
2728
end
28-
nav.with_item(
29-
href: log_patient_path(patient),
30-
text: "Activity log",
31-
selected: active == :log
32-
)
29+
30+
unless Flipper.enabled?(:child_record_redesign)
31+
nav.with_item(
32+
href: log_patient_path(patient),
33+
text: "Activity log",
34+
selected: active == :log
35+
)
36+
end
3337
end
3438
end
3539

app/controllers/patients_controller.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ def show
3333
end
3434

3535
def log
36+
# This action and the corresponding view can be deleted when the
37+
# `child_record_redesign` feature flag is removed.
38+
render status: :not_found if Flipper.enabled?(:child_record_redesign)
3639
end
3740

3841
def edit

app/views/patients/programmes/show.html.erb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,12 @@
2020
<% card.with_heading { "Sessions" } %>
2121
<%= render AppPatientProgrammeSessionTableComponent.new(@patient, current_team:, programme_type: @programme.type) %>
2222
<% end %>
23+
24+
<%= render AppCardComponent.new(section: true) do |card| %>
25+
<% card.with_heading { "Programme activity" } %>
26+
<%= render AppActivityLogComponent.new(
27+
patient: @patient,
28+
programme_type: @programme.type,
29+
team: current_team,
30+
) %>
31+
<% end %>

spec/features/viewing_child_records_spec.rb

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@
2222
then_i_see_the_childs_flu_vaccinations
2323
and_i_see_the_childs_flu_sessions
2424
and_the_flu_tab_is_selected
25+
and_i_see_the_activity_log_for_flu
2526

2627
when_i_click_on_the_hpv_tab
2728
then_i_see_the_childs_hpv_vaccinations
2829
and_i_see_the_childs_hpv_sessions
2930
and_the_hpv_tab_is_selected
31+
and_i_see_the_activity_log_for_hpv
3032
end
3133

3234
def given_that_the_child_record_redesign_feature_flag_is_enabled
@@ -88,13 +90,14 @@ def and_patients_exist
8890
end
8991

9092
def and_the_patient_is_vaccinated
91-
create(
92-
:vaccination_record,
93-
outcome: :administered,
94-
patient: @patient,
95-
programme: @hpv,
96-
session: @session
97-
)
93+
@vaccination_record =
94+
create(
95+
:vaccination_record,
96+
outcome: :administered,
97+
patient: @patient,
98+
programme: @hpv,
99+
session: @session
100+
)
98101
end
99102

100103
def when_i_click_on_children
@@ -181,4 +184,20 @@ def and_i_see_the_childs_hpv_sessions
181184
expect(page).to have_content("Vaccinated")
182185
end
183186
end
187+
188+
def and_i_see_the_activity_log_for_flu
189+
within(".nhsuk-card", text: "Programme activity") do
190+
expect(page).to have_content(
191+
"Added to the session at #{@session.location.name}"
192+
)
193+
end
194+
end
195+
196+
def and_i_see_the_activity_log_for_hpv
197+
within(".nhsuk-card", text: "Programme activity") do
198+
expect(page).to have_content(
199+
"Vaccinated with #{@vaccination_record.vaccine.brand}"
200+
)
201+
end
202+
end
184203
end

0 commit comments

Comments
 (0)