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
1 change: 0 additions & 1 deletion app/jobs/reports/irs_verification_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def irs_verification_report
@irs_verification_report ||= Reporting::IrsVerificationReport.new(
time_range: previous_week_range,
issuers: IdentityConfig.store.irs_verification_report_issuers || [],
# issuers: ['urn:gov:gsa:openidconnect.profiles:sp:sso:irs:sample'], # Make dynamic
)
end

Expand Down
24 changes: 11 additions & 13 deletions lib/reporting/irs_verification_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ class IrsVerificationReport
attr_reader :issuers, :time_range

VERIFICATION_DEMAND = 'IdV: doc auth welcome visited'
DOCUMENT_AUTHENTICATION_SUCCESS = ['IdV: doc auth image upload vendor pii validation',
'IdV: doc auth capture_complete visited'].freeze
INFORMATION_VALIDATION_SUCCESS = 'IdV: doc auth verify submitted'
PHONE_VERIFICATION_SUCCESS = 'IdV: phone confirmation vendor'
DOCUMENT_AUTHENTICATION_SUCCESS = 'IdV: doc auth ssn visited'
INFORMATION_VALIDATION_SUCCESS = 'IdV: phone of record visited'
PHONE_VERIFICATION_SUCCESS = 'idv_enter_password_submitted'
TOTAL_VERIFIED = 'User registration: complete'

# @param [Array<String>] issuers
Expand All @@ -39,6 +38,14 @@ def as_tables

def as_emailable_reports
[
Reporting::EmailableReport.new(
title: 'Definitions',
subtitle: '',
float_as_percent: true,
precision: 2,
table: data_definition_table,
filename: 'Definitions',
),
Reporting::EmailableReport.new(
title: 'Overview',
subtitle: '',
Expand All @@ -55,15 +62,6 @@ def as_emailable_reports
table: funnel_table,
filename: 'Funnel Metrics',
),
Reporting::EmailableReport.new(
title: 'Metrics Definitions',
subtitle: '',
float_as_percent: true,
precision: 2,
table: data_definition_table,
filename: 'Metric Definitions',
),

]
end

Expand Down
34 changes: 21 additions & 13 deletions spec/lib/reporting/irs_verification_report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@

def previous_week_range
one_week = 7.days
last_sunday = Time.zone.today.beginning_of_week(:sunday) - one_week
last_sunday = Time.current.utc.to_date.beginning_of_week(:sunday) - one_week
last_saturday = last_sunday + 6.days
last_sunday..last_saturday
end

describe '#overview_table' do
it 'generates the overview table with the correct data' do
# Dynamically calculate the expected "Report Generated" date
expected_generated_date = Time.zone.today.to_date.to_s
# Adjust this logic if the method uses a different approach
freeze_time do
expected_generated_date = Time.current.utc.to_date.to_s

table = report.overview_table
table = report.overview_table

expect(table).to include(
['Report Timeframe', "#{time_range.begin.to_date} to #{time_range.end.to_date}"],
['Report Generated', expected_generated_date], # Dynamically match the generated date
['Issuer', issuers.join(', ')],
)
expect(table).to include(
['Report Timeframe', "#{time_range.begin.to_date} to #{time_range.end.to_date}"],
['Report Generated', expected_generated_date],
['Issuer', issuers.join(', ')],
)
end
end
end

Expand Down Expand Up @@ -63,9 +63,17 @@ def previous_week_range

expect(csvs).to be_an(Array)
expect(csvs.size).to eq(3) # One for each table
expect(csvs.first).to include('Report Timeframe')
expect(csvs[1]).to include('Metric,Count,Rate')
expect(csvs.last).to include('Metric,Definition')

# First CSV: Definitions
expect(csvs.first).to include('Metric,Definition')

# Second CSV: Overview table
expect(csvs[1]).to include('Report Timeframe')
expect(csvs[1]).to include('Report Generated')
expect(csvs[1]).to include('Issuer')

# Third CSV: Funnel table
expect(csvs.last).to include('Metric,Count,Rate')
end
end
end
2 changes: 1 addition & 1 deletion spec/mailers/previews/report_mailer_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def irs_verification_report
email: 'test@example.com',
subject: "Example IRS Verification Report - #{Time.zone.now.to_date}",
message: "Report: IRS Verification Report - #{Time.zone.now.to_date}",
attachment_format: :xlsx,
attachment_format: :csv,
reports: irs_verification_report.reports,
)
end
Expand Down