Skip to content

Commit e6765dd

Browse files
committed
Use AppPatientTableComponent
This updates the campaign patients tab to use the `AppPatientTableComponent` to render a list of patients attached to the campaign.
1 parent 6425288 commit e6765dd

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

app/components/app_patient_table_component.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def outcome_for(patient:)
3030
def href_for(patient:)
3131
patient_session = patient_session_for(patient:)
3232
session = patient_session.session
33-
section = "vaccinations"
3433

3534
tab =
3635
if patient_session.vaccination_administered?
@@ -41,7 +40,7 @@ def href_for(patient:)
4140
"vaccinate"
4241
end
4342

44-
session_patient_path(session, patient, section:, tab:)
43+
session_patient_path(session, patient, section: "vaccinations", tab:)
4544
end
4645

4746
def patient_session_for(patient:)

app/controllers/campaigns_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def show
2020
end
2121

2222
def patients
23+
@patients = @campaign.patients.active
2324
end
2425

2526
def sessions

app/views/campaigns/patients.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@
3232
href: campaign_immunisation_imports_path(@campaign),
3333
)
3434
end %>
35+
36+
<%= render AppPatientTableComponent.new(@patients, campaign: @campaign) %>

spec/features/immunisation_imports_upload_spec.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,11 @@ def when_i_click_on_cohort
160160
end
161161

162162
def then_i_should_see_the_cohort
163-
# TODO: to be built
163+
expect(page).to have_content("Full nameNHS numberDate of birthOutcome")
164+
expect(page).to have_content("Full name Chyna Pickle")
165+
expect(page).to have_content(/NHS number.*742.*018.*0008/)
166+
expect(page).to have_content("Date of birth 12 September 2012")
167+
expect(page).to have_content("Outcome Vaccinated")
164168
end
165169

166170
def when_i_click_on_vaccination_records

0 commit comments

Comments
 (0)