-
Notifications
You must be signed in to change notification settings - Fork 167
LG-15119 query optimization #11574
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
LG-15119 query optimization #11574
Changes from 8 commits
4a1c912
5789a55
7878906
635bde1
be510ef
fd04942
a19347c
49038c6
df40e9e
15761e9
fee6532
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 |
|---|---|---|
|
|
@@ -48,12 +48,12 @@ def agency_and_sp_emailable_report | |
| end | ||
|
|
||
| def active_agencies | ||
| @active_agencies ||= Agreements::PartnerAccountStatus.find_by(name: 'active'). | ||
| partner_accounts. | ||
| includes(:agency). | ||
| where('became_partner <= ?', report_date). | ||
| map(&:agency). | ||
| uniq | ||
| @active_agencies ||= Agency.joins(:partner_accounts). | ||
| where(partner_accounts: { | ||
| partner_account_status: Agreements::PartnerAccountStatus.find_by(name: 'active'), | ||
| became_partner: ..report_date, | ||
| }). | ||
| distinct | ||
|
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. this has a 2x speed improvement |
||
| end | ||
|
|
||
| def service_providers | ||
|
|
@@ -67,11 +67,12 @@ def service_providers | |
| end | ||
|
|
||
| def facial_match_issuers | ||
| @facial_match_issuers ||= Profile.where(active: true).where( | ||
| 'verified_at <= ?', | ||
| report_date.end_of_day, | ||
| ).where(idv_level: Profile::FACIAL_MATCH_IDV_LEVELS). | ||
| pluck(:initiating_service_provider_issuer).uniq | ||
| @facial_match_issuers ||= Reports::BaseReport.transaction_with_timeout do | ||
| Profile.active.verified.facial_match. | ||
| where('verified_at <= ?', report_date.end_of_day). | ||
|
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. Is the
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. yeah, it can't be active without verified so idk why I am the way that I am. |
||
| distinct. | ||
| pluck(:initiating_service_provider_issuer) | ||
| end | ||
| end | ||
| end | ||
| end | ||
Uh oh!
There was an error while loading. Please reload this page.