Skip to content

Commit 1dcacbd

Browse files
committed
Add extended subtitle to AppLogEventComponent
We are going to use this to add more detail to activity log entries that have both a performed_at and reported_at date so that it's clearer to users what both timestamps mean. Jira-Issue: MAV-3409 Jira-Issue: MAV-2848
1 parent 4955edf commit 1dcacbd

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

app/components/app_activity_log_component.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,12 +410,21 @@ def vaccination_events
410410
"Vaccination not given: #{vaccination_record.human_enum_name(:outcome)}"
411411
end
412412

413+
subtitle =
414+
if vaccination_record.administered? &&
415+
vaccination_record.reported_at.present? &&
416+
(vaccination_record.sourced_from_manual_report? ||
417+
vaccination_record.sourced_from_historical_upload?)
418+
"Record added #{vaccination_record.reported_at.to_fs(:long)}. Vaccination given #{vaccination_record.performed_at.to_fs(:long)}."
419+
end
420+
413421
kept = {
414422
title:,
415423
body: vaccination_record.notes,
416424
at: vaccination_record.performed_at,
417425
by: vaccination_record.performed_by,
418-
programmes: [vaccination_record.programme]
426+
programmes: [vaccination_record.programme],
427+
subtitle:
419428
}
420429

421430
discarded =

app/components/app_log_event_component.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ def initialize(
3838
by: nil,
3939
programmes: [],
4040
invalidated: false,
41-
card: false
41+
card: false,
42+
subtitle: nil
4243
)
4344
@title = title
4445
@body = body
@@ -47,13 +48,14 @@ def initialize(
4748
@programmes = programmes
4849
@invalidated = invalidated
4950
@card = card
51+
@subtitle = subtitle
5052
end
5153

5254
private
5355

5456
attr_reader :title, :body, :programmes, :invalidated, :card
5557

5658
def subtitle
57-
safe_join([@at, @by].compact, " · ".html_safe)
59+
@subtitle || safe_join([@at, @by].compact, " · ".html_safe)
5860
end
5961
end

spec/components/app_activity_log_component_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@
221221

222222
include_examples "card",
223223
title: "Historical vaccination record added",
224-
date: "6 January 2025",
224+
date: "Record added 15 December 2025 at 2:33pm. Vaccination given 6 January 2025.",
225225
programme: "Flu"
226226

227227
include_examples "card",

0 commit comments

Comments
 (0)