Skip to content

Commit 77accfc

Browse files
committed
Use Consent#submitted_at in activity log
This is a more accurate representation of when the consent was submitted rather than using the `created_at`.
1 parent e449da2 commit 77accfc

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

app/components/app_activity_log_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def consent_events
9999
{
100100
title:
101101
"Consent #{original_response} by #{consent.name} (#{consent.who_responded})",
102-
at: consent.created_at,
102+
at: consent.submitted_at,
103103
by: consent.recorded_by,
104104
programmes: programmes_for(consent)
105105
}

spec/components/app_activity_log_component_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
programme: programmes.first,
6464
patient:,
6565
parent: mum,
66-
created_at: Time.zone.parse("2024-05-30 12:00"),
66+
submitted_at: Time.zone.parse("2024-05-30 12:00"),
6767
recorded_by: user
6868
)
6969
create(
@@ -72,7 +72,7 @@
7272
programme: programmes.first,
7373
patient:,
7474
parent: dad,
75-
created_at: Time.zone.parse("2024-05-30 13:00")
75+
submitted_at: Time.zone.parse("2024-05-30 13:00")
7676
)
7777

7878
create(
@@ -251,7 +251,7 @@
251251
:self_consent,
252252
programme: programmes.first,
253253
patient:,
254-
created_at: Time.zone.parse("2024-05-30 12:00")
254+
submitted_at: Time.zone.parse("2024-05-30 12:00")
255255
)
256256
end
257257

@@ -308,7 +308,7 @@
308308
programme: programmes.first,
309309
patient:,
310310
parent: mum,
311-
created_at: Time.zone.local(2024, 5, 30, 12),
311+
submitted_at: Time.zone.local(2024, 5, 30, 12),
312312
withdrawn_at: Time.zone.local(2024, 6, 30, 12)
313313
)
314314
end
@@ -333,7 +333,7 @@
333333
programme: programmes.first,
334334
patient:,
335335
parent: mum,
336-
created_at: Time.zone.local(2024, 5, 30, 12),
336+
submitted_at: Time.zone.local(2024, 5, 30, 12),
337337
invalidated_at: Time.zone.local(2024, 6, 30, 12)
338338
)
339339
end

spec/factories/consents.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
end
7373
end
7474

75-
submitted_at { Time.current }
75+
submitted_at { consent_form&.recorded_at || Time.current }
7676

7777
traits_for_enum :response
7878

0 commit comments

Comments
 (0)