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
15 changes: 7 additions & 8 deletions app/jobs/reports/monthly_account_reuse_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,23 @@ def agency_reuse_results
SELECT
COUNT(DISTINCT agencies.id) AS num_agencies
, identities.user_id
FROM
FROM
identities
JOIN
JOIN
service_providers sp ON identities.service_provider = sp.issuer
JOIN
JOIN
agencies ON sp.agency_id = agencies.id
WHERE
identities.last_ial2_authenticated_at IS NOT NULL
AND
identities.verified_at < %{query_date}
GROUP BY
GROUP BY
identities.user_id
) agencies_per_user
GROUP BY
GROUP BY
agencies_per_user.num_agencies
HAVING agencies_per_user.num_agencies > 1
ORDER BY
ORDER BY
num_agencies ASC
SQL

Expand Down Expand Up @@ -109,8 +109,7 @@ def total_reuse_report

if total_proofed > 0
reuse_stats.each_with_index do |result_entry, index|
reuse_stats[index]['percentage'] =
result_entry['num_users'] / total_proofed.to_f * 100
reuse_stats[index]['percentage'] = result_entry['num_users'] / total_proofed.to_f

reuse_total_percentage += reuse_stats[index]['percentage']
end
Expand Down
6 changes: 3 additions & 3 deletions spec/jobs/reports/monthly_account_reuse_report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ def create_identity(id, provider, verified_time)
[
{ title: 'IDV app reuse rate Feb-2021', float_as_percent: true, precision: 4 },
['Num. SPs', 'Num. users', 'Percentage'],
[2, 3, 30.0],
[3, 2, 20.0],
['Total (all >1)', 5, 50.0],
[2, 3, 0.3],
[3, 2, 0.2],
['Total (all >1)', 5, 0.5],
],
[
{ title: 'Total proofed identities' },
Expand Down