Skip to content

Commit afe99e3

Browse files
committed
Don't ask full or half dose question by default
When recording a vaccination the default should be full dose, and the nurse can change their answer to half dose if they need to. We shouldn't be asking this question by default. In fact, this question was only being shown when today's batch had been selected due to the order of the questions, but now the behaviour is consistent regardless of whether a default batch has been selected or not. Jira-Issue: MAV-1504
1 parent e4a6cbf commit afe99e3

7 files changed

Lines changed: 22 additions & 29 deletions

File tree

app/controllers/draft_vaccination_records_controller.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ def update
4949
jump_to("confirm")
5050
end
5151

52+
set_steps
53+
setup_wizard_translated
54+
5255
render_wizard @draft_vaccination_record
5356
end
5457

app/controllers/patient_sessions/vaccinations_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def create
2727
steps = draft_vaccination_record.wizard_steps
2828

2929
steps.delete(:notes) # this is on the confirmation page
30-
steps.delete(:identity) # this is on the confirmation page
30+
steps.delete(:identity) # this can only be changed from confirmation page
31+
steps.delete(:dose) # this can only be changed from confirmation page
3132

3233
steps.delete(:date_and_time)
3334
steps.delete(:outcome) if draft_vaccination_record.administered?

app/forms/vaccinate_form.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def save(draft_vaccination_record:)
5959

6060
draft_vaccination_record.batch_id = todays_batch&.id
6161
draft_vaccination_record.dose_sequence = dose_sequence
62+
draft_vaccination_record.full_dose = true
6263
draft_vaccination_record.identity_check_confirmed_by_other_name =
6364
identity_check_confirmed_by_other_name
6465
draft_vaccination_record.identity_check_confirmed_by_other_relationship =

app/models/draft_vaccination_record.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ def self.request_session_key
4040

4141
def wizard_steps
4242
[
43-
:notes,
4443
:identity,
44+
:notes,
4545
:date_and_time,
4646
(:outcome if can_change_outcome?),
4747
(:delivery if administered?),
48-
(:batch if administered?),
4948
(:dose if administered? && can_be_half_dose?),
49+
(:batch if administered?),
5050
(:location if location&.generic_clinic?),
5151
:confirm
5252
].compact
@@ -212,7 +212,6 @@ def delivery_method=(value)
212212
end
213213

214214
delegate :vaccine, to: :batch, allow_nil: true
215-
delegate :can_be_half_dose?, to: :vaccine, allow_nil: true
216215

217216
delegate :id, to: :vaccine, prefix: true, allow_nil: true
218217

@@ -297,6 +296,10 @@ def reset_unused_fields
297296
end
298297
end
299298

299+
def can_be_half_dose?
300+
delivery_method.in?(Vaccine::NASAL_DELIVERY_METHODS)
301+
end
302+
300303
def can_change_outcome?
301304
outcome != "already_had" || editing? || session.nil? || session.today?
302305
end

app/models/vaccine.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ def active? = !discontinued
6161

6262
def contains_gelatine? = programme.flu? && nasal?
6363

64-
def can_be_half_dose? = nasal?
65-
6664
AVAILABLE_DELIVERY_SITES = {
6765
"injection" => %w[
6866
left_arm_upper_position

spec/features/flu_vaccination_administered_spec.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,13 @@ def and_there_is_a_flu_session_today_with_two_patients_ready_to_vaccinate
8989
end
9090

9191
def and_there_are_nasal_and_injection_batches
92-
@nasal_vaccine = create(:vaccine, programme: @programme, method: :nasal)
92+
@nasal_vaccine =
93+
create(
94+
:vaccine,
95+
programme: @programme,
96+
method: :nasal,
97+
dose_volume_ml: 0.2
98+
)
9399
@nasal_batch =
94100
create(
95101
:batch,
@@ -150,6 +156,8 @@ def when_i_record_that_the_patient_has_been_vaccinated_with_nasal_spray
150156

151157
choose @nasal_batch.name
152158
click_button "Continue"
159+
160+
expect(page).not_to have_content("Did they get the full dose?")
153161
end
154162

155163
def when_i_record_that_the_patient_has_been_vaccinated_with_injection
@@ -173,6 +181,7 @@ def then_i_see_the_check_and_confirm_page_for_nasal_spray
173181
expect(page).to have_content(@nasal_batch.name)
174182
expect(page).to have_content("Nasal spray")
175183
expect(page).to have_content("Nose")
184+
expect(page).to have_content("Dose volume0.2 ml")
176185
expect(page).to have_content(@location.name)
177186
expect(page).to have_content("Vaccinated")
178187
end

spec/models/vaccine_spec.rb

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -58,28 +58,6 @@
5858
end
5959
end
6060

61-
describe "#can_be_half_dose?" do
62-
subject { vaccine.can_be_half_dose? }
63-
64-
context "with a nasal Flu vaccine" do
65-
let(:vaccine) { build(:vaccine, :fluenz_tetra) }
66-
67-
it { should be(true) }
68-
end
69-
70-
context "with an injected Flu vaccine" do
71-
let(:vaccine) { build(:vaccine, :quadrivalent_influenza) }
72-
73-
it { should be(false) }
74-
end
75-
76-
context "with an HPV vaccine" do
77-
let(:vaccine) { build(:vaccine, :gardasil_9) }
78-
79-
it { should be(false) }
80-
end
81-
end
82-
8361
describe "#available_delivery_methods" do
8462
subject { vaccine.available_delivery_methods }
8563

0 commit comments

Comments
 (0)