-
Notifications
You must be signed in to change notification settings - Fork 166
LG-11148 | Adds monthly report on total verified users #9376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8b8abdc
0073046
ba042e4
c82aecb
dc824fa
a6529f8
a7bd27a
08f6257
f90cfc6
82cff22
e987ffa
063cd29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,14 +10,21 @@ def initialize(report_date = Time.zone.today) | |
|
|
||
| def total_user_count_report | ||
| [ | ||
| ['All-time user count'], | ||
| [total_user_count], | ||
| ['Metric', 'Value', 'Time Range Start', 'Time Range End'], | ||
| ['All-time user count', total_user_count, '-', report_date.strftime('%F')], | ||
| ['Total verified users', verified_user_count, '-', report_date.strftime('%F')], | ||
| [ | ||
| 'Total annual users', | ||
| annual_total_user_count, | ||
| annual_start_date.strftime('%F'), | ||
| end_date.strftime('%F'), | ||
| ], | ||
| ] | ||
| end | ||
|
|
||
| def total_user_count_emailable_report | ||
| EmailableReport.new( | ||
| title: 'Total user count (all-time)', | ||
| title: 'Total user counts', | ||
| table: total_user_count_report, | ||
| filename: 'total_user_count', | ||
| ) | ||
|
|
@@ -27,8 +34,28 @@ def total_user_count_emailable_report | |
|
|
||
| def total_user_count | ||
| Reports::BaseReport.transaction_with_timeout do | ||
| User.where('created_at <= ?', report_date).count | ||
| User.where('created_at <= ?', end_date).count | ||
| end | ||
| end | ||
|
|
||
| def verified_user_count | ||
| Reports::BaseReport.transaction_with_timeout do | ||
| Profile.where(active: true).where('activated_at <= ?', end_date).count | ||
| end | ||
| end | ||
|
|
||
| def annual_total_user_count | ||
| Reports::BaseReport.transaction_with_timeout do | ||
| User.where(created_at: annual_start_date..end_date).count | ||
| end | ||
| end | ||
|
|
||
| def annual_start_date | ||
| (report_date - 1.year).beginning_of_day | ||
| end | ||
|
|
||
| def end_date | ||
| report_date.beginning_of_day | ||
| end | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am boldly just assuming that the request for "verified users" means "IdV users," but hopefully @zachmargolis or someone can confirm if that is how others would interpret the term? And to slightly further open the can of worms: I'm including the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah that's a correct interpretation and yes, we should keep the handbook query here
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I worked with @olatifflexion to We confirmed with Cale in the original doc that "annual" here refers to the previous 12 months, not fiscal/calendar year. |
||
| end | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,16 @@ | |
| let(:account_deletion_rate_s3_path) { "#{report_folder}/account_deletion_rate.csv" } | ||
| let(:total_user_count_s3_path) { "#{report_folder}/total_user_count.csv" } | ||
| let(:monthly_active_users_count_s3_path) { "#{report_folder}/monthly_active_users_count.csv" } | ||
| let(:expected_s3_paths) do | ||
| [ | ||
| account_reuse_s3_path, | ||
| total_profiles_s3_path, | ||
| account_deletion_rate_s3_path, | ||
| total_user_count_s3_path, | ||
| document_upload_proofing_s3_path, | ||
| monthly_active_users_count_s3_path, | ||
| ] | ||
| end | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I built an array of all these expected S3 files so that... |
||
| let(:s3_metadata) do | ||
| { | ||
| body: anything, | ||
|
|
@@ -91,35 +101,12 @@ | |
| end | ||
|
|
||
| it 'uploads a file to S3 based on the report date' do | ||
| expect(subject).to receive(:upload_file_to_s3_bucket).with( | ||
| path: total_user_count_s3_path, | ||
| **s3_metadata, | ||
| ).exactly(1).time.and_call_original | ||
|
|
||
| expect(subject).to receive(:upload_file_to_s3_bucket).with( | ||
| path: account_deletion_rate_s3_path, | ||
| **s3_metadata, | ||
| ).exactly(1).time.and_call_original | ||
|
|
||
| expect(subject).to receive(:upload_file_to_s3_bucket).with( | ||
| path: account_reuse_s3_path, | ||
| **s3_metadata, | ||
| ).exactly(1).time.and_call_original | ||
|
|
||
| expect(subject).to receive(:upload_file_to_s3_bucket).with( | ||
| path: total_profiles_s3_path, | ||
| **s3_metadata, | ||
| ).exactly(1).time.and_call_original | ||
|
|
||
| expect(subject).to receive(:upload_file_to_s3_bucket).with( | ||
| path: document_upload_proofing_s3_path, | ||
| **s3_metadata, | ||
| ).exactly(1).time.and_call_original | ||
|
|
||
| expect(subject).to receive(:upload_file_to_s3_bucket).with( | ||
| path: monthly_active_users_count_s3_path, | ||
| **s3_metadata, | ||
| ).exactly(1).time.and_call_original | ||
| expected_s3_paths.each do |path| | ||
| expect(subject).to receive(:upload_file_to_s3_bucket).with( | ||
| path: path, | ||
| **s3_metadata, | ||
| ).exactly(1).time.and_call_original | ||
| end | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ...we can replace this with a happy little loop. |
||
|
|
||
| subject.perform(report_date) | ||
| end | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.