From 691e245e7dd31ba0695aebce3b8fd15d0dbfb27d Mon Sep 17 00:00:00 2001 From: Richard Lynch Date: Thu, 12 Sep 2024 17:03:40 +0100 Subject: [PATCH] Show all email sending events Feedback on PR we want to show all admin email sending events on the task, not just the latest one --- .../admin_provider_verification_task_presenter.rb | 6 +++--- .../tasks/_provider_verification_unsubmitted.html.erb | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/models/policies/further_education_payments/admin_provider_verification_task_presenter.rb b/app/models/policies/further_education_payments/admin_provider_verification_task_presenter.rb index 84329057d0..890ca01694 100644 --- a/app/models/policies/further_education_payments/admin_provider_verification_task_presenter.rb +++ b/app/models/policies/further_education_payments/admin_provider_verification_task_presenter.rb @@ -25,8 +25,8 @@ def rows end end - def latest_admin_sent_email - claim.notes.by_label("provider_verification").order(created_at: :desc).first + def admin_sent_emails + @admin_sent_emails ||= claim.notes.by_label("provider_verification").order(created_at: :desc) end def verification_email_sent? @@ -34,7 +34,7 @@ def verification_email_sent? end def verification_email_sent_by_admin_team? - latest_admin_sent_email.present? + admin_sent_emails.any? end private diff --git a/app/views/admin/tasks/_provider_verification_unsubmitted.html.erb b/app/views/admin/tasks/_provider_verification_unsubmitted.html.erb index 42861d50d4..adb49e9a92 100644 --- a/app/views/admin/tasks/_provider_verification_unsubmitted.html.erb +++ b/app/views/admin/tasks/_provider_verification_unsubmitted.html.erb @@ -1,11 +1,12 @@ <% if @tasks_presenter.provider_verification.verification_email_sent? %> <% if @tasks_presenter.provider_verification.verification_email_sent_by_admin_team? %> - <% verification_email = @tasks_presenter.provider_verification.latest_admin_sent_email %>
-

- The verification request was sent to the provider by - <%= user_details(verification_email.created_by) %> on <%= l(verification_email.created_at) %> -

+ <% @tasks_presenter.provider_verification.admin_sent_emails.each do |verification_email| %> +

+ The verification request was sent to the provider by + <%= user_details(verification_email.created_by) %> on <%= l(verification_email.created_at) %> +

+ <% end %>
<% end %>