Skip to content

Commit

Permalink
Remove lazy loading for performance
Browse files Browse the repository at this point in the history
  • Loading branch information
elceebee committed Jul 10, 2024
1 parent d14ebb8 commit fb504a6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def self.call

def self.deadline_reminder_query
ApplicationForm
.includes(:candidate)
.joins(:candidate)
.current_cycle
.unsubmitted
.where.not(candidate: { unsubscribed_from_emails: true })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class GetIncompleteCourseChoiceApplicationsReadyToNudge

def call
ApplicationForm
.includes(:candidate)
.joins(:candidate)
.where.not('candidate.submission_blocked': true)
.where.not('candidate.account_locked': true)
.where.not('candidate.unsubscribed_from_emails': true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ def call
.inactive_since(7.days.ago)
.with_completion(COMPLETION_ATTRS)
.current_cycle
.includes(:candidate)
.joins(:candidate)
.where.not('candidate.submission_blocked': true)
.where.not('candidate.account_locked': true)
.where.not('candidate.unsubscribed_from_emails': true)
.where(INCOMPLETION_ATTRS.map { |attr| "#{attr} = false" }.join(' AND '))
.has_not_received_email(MAILER, MAIL_TEMPLATE)
.includes(:application_choices).where('application_choices.status': 'unsubmitted')
.joins(:application_choices).where('application_choices.status': 'unsubmitted')
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def call
uk_and_irish = uk_and_irish_names.map { |name| ActiveRecord::Base.connection.quote(name) }.join(',')

ApplicationForm
.includes(:candidate)
.joins(:candidate)
.where.not('candidate.submission_blocked': true)
.where.not('candidate.account_locked': true)
.where.not('candidate.unsubscribed_from_emails': true)
Expand Down
4 changes: 2 additions & 2 deletions app/queries/get_unsubmitted_applications_ready_to_nudge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ def call
.with_completion(COMMON_COMPLETION_ATTRS)
.current_cycle
.has_not_received_email(MAILER, MAIL_TEMPLATE)
.includes(:candidate)
.joins(:candidate)
.where.not('candidate.submission_blocked': true)
.where.not('candidate.account_locked': true)
.where.not('candidate.unsubscribed_from_emails': true)
.includes(:application_choices).where('application_choices.status': 'unsubmitted')
.joins(:application_choices).where('application_choices.status': 'unsubmitted')
.and(ApplicationForm
.where(science_gcse_completed: true)
.or(
Expand Down

0 comments on commit fb504a6

Please sign in to comment.