app/services/reports/failed_emails_report.rb
# This class method is used in the back-office
This class method is used in the back-office
This class method is used in the back - office
def list
        self.report_type = :backoffice
        self.failures = []
        EmailSubmission.where(
          created_at: 1.week.ago.beginning_of_day...10.minutes.ago
        ).joins(:c100_application).find_each(batch_size: 25) do |record|
          reference_code = record.c100_application.reference_code
          find_failures(record, reference_code, COURT_EMAIL_TYPE)
          find_failures(record, reference_code, USER_EMAIL_TYPE) if record.c100_application.receipt_email?
        end
        failures
      end
def list self . report_type = :backoffice self . failures = [ ] EmailSubmission . where ( created_at : 1 . week . ago . beginning_of_day ... 10 . minutes . ago ) . joins ( :c100_application ) . find_each ( batch_size : 25 ) do | record | reference_code = record . c100_application . reference_code find_failures ( record , reference_code , COURT_EMAIL_TYPE ) find_failures ( record , reference_code , USER_EMAIL_TYPE ) if record . c100_application . receipt_email? end failures end
This class method is used in the back-office
This class method is used in the back - office
# We skip emails created in the last few minutes to give a bit of time # for these recent callbacks to come back. # Only if the applicant chose to receive a confirmation, otherwise # these emails are not sent and there is no need to do any check.