Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions app/jobs/reports/identity_verification_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,19 @@ def perform(report_date)

save_report(REPORT_NAME, csv, extension: 'csv')

if emails.empty?
email = IdentityConfig.store.team_ada_email
if email.blank?
Rails.logger.warn 'No email addresses received - Identity Verification Report NOT SENT'
return false
end

emails.each do |email|
ReportMailer.tables_report(
email: email,
subject: "Daily Identity Verification Report - #{report_date.to_date}",
reports: reports,
message: message,
attachment_format: :xlsx,
).deliver_now
end
ReportMailer.tables_report(
email: email,
subject: "Daily Identity Verification Report - #{report_date.to_date}",
reports: reports,
message: message,
attachment_format: :xlsx,
).deliver_now
end

def message
Expand All @@ -53,10 +52,6 @@ def preamble
HTML
end

def emails
[IdentityConfig.store.team_ada_email].compact
end

def reports
[report_maker.identity_verification_emailable_report]
end
Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/reports/identity_verification_report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
end

it 'does not send report in email if the email field is empty' do
allow(IdentityConfig.store).to receive(:team_ada_email).and_return(nil)
allow(IdentityConfig.store).to receive(:team_ada_email).and_return('')

report_maker = double(
Reporting::IdentityVerificationReport,
Expand Down