Skip to content

Commit d5f0a5a

Browse files
committed
Allow seeing draft vaccination records
This makes it possible to see the information about a vaccination record before it's recorded by updating the controller to see all vaccination records.
1 parent 1376ee3 commit d5f0a5a

File tree

3 files changed

+28
-10
lines changed

3 files changed

+28
-10
lines changed

app/controllers/vaccination_records_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class VaccinationRecordsController < ApplicationController
44
def index
5-
@vaccination_records = vaccination_records
5+
@vaccination_records = vaccination_records.recorded
66

77
render layout: "full"
88
end
@@ -38,12 +38,12 @@ def vaccination_records
3838
.includes(
3939
:batch,
4040
:campaign,
41+
:imported_from,
4142
:performed_by_user,
4243
:vaccine,
4344
patient: :school,
4445
session: :location
4546
)
46-
.recorded
4747
.where(campaign:)
4848
.order(:recorded_at)
4949
.strict_loading

app/views/vaccination_records/show.html.erb

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
<% content_for :before_main do %>
2-
<%= render AppBreadcrumbComponent.new(items: [
3-
{ text: t("campaigns.index.title"), href: campaigns_path },
4-
{ text: @campaign.name, href: campaign_vaccination_records_path(@campaign) },
5-
{ text: t("vaccination_records.index.title"), href: campaign_vaccination_records_path(@campaign) },
6-
]) %>
2+
<% if @vaccination_record.recorded? %>
3+
<%= render AppBreadcrumbComponent.new(items: [
4+
{ text: t("campaigns.index.title"), href: campaigns_path },
5+
{ text: @campaign.name, href: campaign_vaccination_records_path(@campaign) },
6+
{ text: t("vaccination_records.index.title"), href: campaign_vaccination_records_path(@campaign) },
7+
]) %>
8+
<% elsif (immunisation_import = @vaccination_record.imported_from) %>
9+
<%= render AppBacklinkComponent.new(
10+
href: edit_campaign_immunisation_import_path(
11+
@campaign,
12+
immunisation_import
13+
),
14+
name: "check and confirm upload",
15+
) %>
16+
<% end %>
717
<% end %>
818

919
<%= h1 @patient.full_name %>

spec/features/immunisation_imports_upload_spec.rb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
then_i_should_see_the_success_heading
2424
and_i_should_see_the_vaccination_records
2525

26-
when_i_click_on_upload_records
26+
when_i_click_on_a_vaccination_record
27+
then_i_should_see_the_vaccination_record
28+
29+
when_i_go_back
30+
and_i_click_on_upload_records
2731
then_i_should_see_the_upload
2832
and_i_should_see_the_vaccination_records
2933

@@ -126,7 +130,11 @@ def and_i_should_see_the_vaccination_records
126130
expect(page).to have_content("Vaccination date 14 May 2024")
127131
end
128132

129-
def when_i_click_on_upload_records
133+
def when_i_go_back
134+
click_on "Back to check and confirm upload"
135+
end
136+
137+
def and_i_click_on_upload_records
130138
click_on "Upload records"
131139
end
132140

@@ -149,7 +157,7 @@ def then_i_should_see_the_vaccination_record
149157
expect(page).to have_content("Chyna Pickle")
150158
expect(page).to have_content("Child record")
151159
expect(page).to have_content("NameChyna Pickle")
152-
expect(page).to have_content("Vaccination record")
160+
expect(page).to have_content("Vaccination details")
153161
expect(page).to have_content("OutcomeVaccinated")
154162
end
155163

0 commit comments

Comments
 (0)