Skip to content

Commit 0bd4f2b

Browse files
committed
List historical vaccinations under reported at date
We want them to appear in the activity log at date of reporting not vaccination so that they tie up with any notifications that may get sent out. Jira-Issue: MAV-3409 Jira-Issue: MAV-2848
1 parent 49c5a46 commit 0bd4f2b

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

app/components/app_activity_log_component.rb

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -411,20 +411,16 @@ def vaccination_events
411411
end
412412

413413
subtitle =
414-
if vaccination_record.administered? &&
415-
vaccination_record.reported_at.present? &&
416-
(
417-
vaccination_record.sourced_from_manual_report? ||
418-
vaccination_record.sourced_from_historical_upload?
419-
)
414+
if historical_vaccination_event?(vaccination_record)
420415
"Record added #{vaccination_record.reported_at.to_fs(:long)}. " \
421416
"Vaccination given #{vaccination_record.performed_at.to_date.to_fs(:long)}."
422417
end
418+
at = historical_vaccination_event?(vaccination_record) ? vaccination_record.reported_at : vaccination_record.performed_at
423419

424420
kept = {
425421
title:,
426422
body: vaccination_record.notes,
427-
at: vaccination_record.performed_at,
423+
at:,
428424
by: vaccination_record.performed_by,
429425
programmes: [vaccination_record.programme],
430426
subtitle:
@@ -443,6 +439,14 @@ def vaccination_events
443439
end
444440
end
445441

442+
def historical_vaccination_event?(vaccination_record)
443+
vaccination_record.reported_at.present? &&
444+
(
445+
vaccination_record.sourced_from_manual_report? ||
446+
vaccination_record.sourced_from_historical_upload?
447+
)
448+
end
449+
446450
def attendance_events
447451
attendance_records.map do |attendance_record|
448452
title =

spec/components/app_activity_log_component_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
session:,
176176
performed_at: Date.new(2025, 1, 6),
177177
performed_by: nil,
178-
reported_at: Time.zone.local(2025, 12, 15, 14, 33, 23),
178+
reported_at: Time.zone.local(2025, 2, 15, 14, 33, 23),
179179
source: :manual_report,
180180
vaccine: nil
181181
)
@@ -222,7 +222,7 @@
222222
include_examples "card",
223223
title: "Historical vaccination record added",
224224
date:
225-
"Record added 15 December 2025 at 2:33pm. Vaccination given 6 January 2025.",
225+
"Record added 15 February 2025 at 2:33pm. Vaccination given 6 January 2025.",
226226
programme: "Flu"
227227

228228
include_examples "card",

0 commit comments

Comments
 (0)