Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions app/components/app_patient_navigation_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def call
text: "Child record",
selected: active == :show
)

if Flipper.enabled?(:child_record_redesign)
@programmes.flat_map do |programme|
nav.with_item(
Expand All @@ -25,11 +26,14 @@ def call
)
end
end
nav.with_item(
href: log_patient_path(patient),
text: "Activity log",
selected: active == :log
)

unless Flipper.enabled?(:child_record_redesign)
nav.with_item(
href: log_patient_path(patient),
text: "Activity log",
selected: active == :log
)
end
end
end

Expand Down
3 changes: 3 additions & 0 deletions app/controllers/patients_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ def show
end

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

def edit
Expand Down
9 changes: 9 additions & 0 deletions app/views/patients/programmes/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,12 @@
<% card.with_heading { "Sessions" } %>
<%= render AppPatientProgrammeSessionTableComponent.new(@patient, current_team:, programme_type: @programme.type) %>
<% end %>

<%= render AppCardComponent.new(section: true) do |card| %>
<% card.with_heading { "Programme activity" } %>
<%= render AppActivityLogComponent.new(
patient: @patient,
programme_type: @programme.type,
team: current_team,
) %>
<% end %>
33 changes: 26 additions & 7 deletions spec/features/viewing_child_records_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
then_i_see_the_childs_flu_vaccinations
and_i_see_the_childs_flu_sessions
and_the_flu_tab_is_selected
and_i_see_the_activity_log_for_flu

when_i_click_on_the_hpv_tab
then_i_see_the_childs_hpv_vaccinations
and_i_see_the_childs_hpv_sessions
and_the_hpv_tab_is_selected
and_i_see_the_activity_log_for_hpv
end

def given_that_the_child_record_redesign_feature_flag_is_enabled
Expand Down Expand Up @@ -88,13 +90,14 @@ def and_patients_exist
end

def and_the_patient_is_vaccinated
create(
:vaccination_record,
outcome: :administered,
patient: @patient,
programme: @hpv,
session: @session
)
@vaccination_record =
create(
:vaccination_record,
outcome: :administered,
patient: @patient,
programme: @hpv,
session: @session
)
end

def when_i_click_on_children
Expand Down Expand Up @@ -181,4 +184,20 @@ def and_i_see_the_childs_hpv_sessions
expect(page).to have_content("Vaccinated")
end
end

def and_i_see_the_activity_log_for_flu
within(".nhsuk-card", text: "Programme activity") do
expect(page).to have_content(
"Added to the session at #{@session.location.name}"
)
end
end

def and_i_see_the_activity_log_for_hpv
within(".nhsuk-card", text: "Programme activity") do
expect(page).to have_content(
"Vaccinated with #{@vaccination_record.vaccine.brand}"
)
end
end
end