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
8 changes: 4 additions & 4 deletions app/jobs/reports/combined_invoice_supplement_report_v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def combine_by_iaa_month(
'partner_ial2_new_unique_users_year4',
'partner_ial2_new_unique_users_year5',
'partner_ial2_new_unique_users_year_greater_than_5',
'partner_ial2_new_unique_users_year_unknown',
'partner_ial2_new_unique_users_unknown',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically this could stay the same, since its the output CSV, and not the key to match the helper, right? But we're just cleaning it up for 100% consistency?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and technically year_unknown is not entirely true it could be unknown for other reasons unrelated to the year


'issuer_ial1_total_auth_count',
'issuer_ial2_total_auth_count',
Expand All @@ -118,7 +118,7 @@ def combine_by_iaa_month(
'issuer_ial2_new_unique_users_year4',
'issuer_ial2_new_unique_users_year5',
'issuer_ial2_new_unique_users_year_greater_than_5',
'issuer_ial2_new_unique_users_year_unknown',
'issuer_ial2_new_unique_users_unknown',
]
by_issuer_iaa_issuer_year_months.each do |iaa_key, issuer_year_months|
issuer_year_months.each do |issuer, year_months_data|
Expand Down Expand Up @@ -161,7 +161,7 @@ def combine_by_iaa_month(
partner_results[:partner_ial2_new_unique_users_year4] || 0,
partner_results[:partner_ial2_new_unique_users_year5] || 0,
partner_results[:partner_ial2_new_unique_users_year_greater_than_5] || 0,
partner_results[:partner_ial2_new_unique_users_year_unknown] || 0,
partner_results[:partner_ial2_new_unique_users_unknown] || 0,

(ial1_total_auth_count = extract(issuer_results, :total_auth_count, ial: 1)),
(ial2_total_auth_count = extract(issuer_results, :total_auth_count, ial: 2)),
Expand All @@ -176,7 +176,7 @@ def combine_by_iaa_month(
issuer_profile_age_results[:partner_ial2_new_unique_users_year4] || 0,
issuer_profile_age_results[:partner_ial2_new_unique_users_year5] || 0,
issuer_profile_age_results[:partner_ial2_new_unique_users_year_greater_than_5] || 0,
issuer_profile_age_results[:partner_ial2_new_unique_users_year_unknown] || 0,
issuer_profile_age_results[:partner_ial2_new_unique_users_unknown] || 0,
]
end
end
Expand Down
41 changes: 27 additions & 14 deletions spec/jobs/reports/combined_invoice_supplement_report_v2_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
let(:user1) { create(:user) }
let(:user2) { create(:user) }
let(:user3) { create(:user) }
let(:user4) { create(:user) }

before do
iaa_order1.integrations << build_integration(
Expand Down Expand Up @@ -142,6 +143,18 @@
billable: true,
)
end

# 1 unique user in month 1 at IAA 2 sp 1 @ IAL 2 with profile age unknown
create(
:sp_return_log,
user_id: user4.id,
ial: 2,
issuer: iaa2_sp1.issuer,
requested_at: inside_iaa2,
returned_at: inside_iaa2,
profile_verified_at: nil,
billable: true,
)
end

it 'generates a report by iaa + order number and issuer and year month' do
Expand Down Expand Up @@ -171,7 +184,7 @@
expect(row['partner_ial2_new_unique_users_year4'].to_i).to eq(0)
expect(row['partner_ial2_new_unique_users_year5'].to_i).to eq(0)
expect(row['partner_ial2_new_unique_users_year_greater_than_5'].to_i).to eq(0)
expect(row['partner_ial2_new_unique_users_year_unknown'].to_i).to eq(0)
expect(row['partner_ial2_new_unique_users_unknown'].to_i).to eq(0)

expect(row['issuer_ial1_total_auth_count'].to_i).to eq(1)
expect(row['issuer_ial2_total_auth_count'].to_i).to eq(0)
Expand All @@ -186,7 +199,7 @@
expect(row['issuer_ial2_new_unique_users_year4'].to_i).to eq(0)
expect(row['issuer_ial2_new_unique_users_year5'].to_i).to eq(0)
expect(row['issuer_ial2_new_unique_users_year_greater_than_5'].to_i).to eq(0)
expect(row['issuer_ial2_new_unique_users_year_unknown'].to_i).to eq(0)
expect(row['issuer_ial2_new_unique_users_unknown'].to_i).to eq(0)
end

aggregate_failures do
Expand All @@ -204,30 +217,30 @@
expect(row['year_month_readable']).to eq('September 2020')

expect(row['iaa_ial1_unique_users'].to_i).to eq(0)
expect(row['iaa_ial2_unique_users'].to_i).to eq(3)
expect(row['iaa_ial1_plus_2_unique_users'].to_i).to eq(3)
expect(row['iaa_ial2_unique_users'].to_i).to eq(4)
expect(row['iaa_ial1_plus_2_unique_users'].to_i).to eq(4)
expect(row['partner_ial2_new_unique_users_year1'].to_i).to eq(1)
expect(row['partner_ial2_new_unique_users_year2'].to_i).to eq(2)
expect(row['partner_ial2_new_unique_users_year3'].to_i).to eq(0)
expect(row['partner_ial2_new_unique_users_year4'].to_i).to eq(0)
expect(row['partner_ial2_new_unique_users_year5'].to_i).to eq(0)
expect(row['partner_ial2_new_unique_users_year_greater_than_5'].to_i).to eq(0)
expect(row['partner_ial2_new_unique_users_year_unknown'].to_i).to eq(0)
expect(row['partner_ial2_new_unique_users_unknown'].to_i).to eq(1)

expect(row['issuer_ial1_total_auth_count'].to_i).to eq(0)
expect(row['issuer_ial2_total_auth_count'].to_i).to eq(1)
expect(row['issuer_ial1_plus_2_total_auth_count'].to_i).to eq(1)
expect(row['issuer_ial2_total_auth_count'].to_i).to eq(2)
expect(row['issuer_ial1_plus_2_total_auth_count'].to_i).to eq(2)

expect(row['issuer_ial1_unique_users'].to_i).to eq(0)
expect(row['issuer_ial2_unique_users'].to_i).to eq(1)
expect(row['issuer_ial1_plus_2_unique_users'].to_i).to eq(1)
expect(row['issuer_ial2_unique_users'].to_i).to eq(2)
expect(row['issuer_ial1_plus_2_unique_users'].to_i).to eq(2)
expect(row['issuer_ial2_new_unique_users_year1'].to_i).to eq(1)
expect(row['issuer_ial2_new_unique_users_year2'].to_i).to eq(0)
expect(row['issuer_ial2_new_unique_users_year3'].to_i).to eq(0)
expect(row['issuer_ial2_new_unique_users_year4'].to_i).to eq(0)
expect(row['issuer_ial2_new_unique_users_year5'].to_i).to eq(0)
expect(row['issuer_ial2_new_unique_users_year_greater_than_5'].to_i).to eq(0)
expect(row['issuer_ial2_new_unique_users_year_unknown'].to_i).to eq(0)
expect(row['issuer_ial2_new_unique_users_unknown'].to_i).to eq(1)
end

aggregate_failures do
Expand All @@ -245,15 +258,15 @@
expect(row['year_month_readable']).to eq('September 2020')

expect(row['iaa_ial1_unique_users'].to_i).to eq(0)
expect(row['iaa_ial2_unique_users'].to_i).to eq(3)
expect(row['iaa_ial1_plus_2_unique_users'].to_i).to eq(3)
expect(row['iaa_ial2_unique_users'].to_i).to eq(4)
expect(row['iaa_ial1_plus_2_unique_users'].to_i).to eq(4)
expect(row['partner_ial2_new_unique_users_year1'].to_i).to eq(1)
expect(row['partner_ial2_new_unique_users_year2'].to_i).to eq(2)
expect(row['partner_ial2_new_unique_users_year3'].to_i).to eq(0)
expect(row['partner_ial2_new_unique_users_year4'].to_i).to eq(0)
expect(row['partner_ial2_new_unique_users_year5'].to_i).to eq(0)
expect(row['partner_ial2_new_unique_users_year_greater_than_5'].to_i).to eq(0)
expect(row['partner_ial2_new_unique_users_year_unknown'].to_i).to eq(0)
expect(row['partner_ial2_new_unique_users_unknown'].to_i).to eq(1)

expect(row['issuer_ial1_total_auth_count'].to_i).to eq(0)
expect(row['issuer_ial2_total_auth_count'].to_i).to eq(2)
Expand All @@ -268,7 +281,7 @@
expect(row['issuer_ial2_new_unique_users_year4'].to_i).to eq(0)
expect(row['issuer_ial2_new_unique_users_year5'].to_i).to eq(0)
expect(row['issuer_ial2_new_unique_users_year_greater_than_5'].to_i).to eq(0)
expect(row['issuer_ial2_new_unique_users_year_unknown'].to_i).to eq(0)
expect(row['issuer_ial2_new_unique_users_unknown'].to_i).to eq(0)
end
end
end
Expand Down