Class: NotificationWorkers::Partner::PerformanceReviewReport
- Inherits:
-
ApplicationWorker
- Object
- ApplicationWorker
- NotificationWorkers::Partner::PerformanceReviewReport
- Includes:
- MoneyRails::ActionViewExtension, RollbarSynTokenSetterWorker, Sidekiq::Status::Worker
- Defined in:
- app/workers/notification_workers/partner/performance_review_report.rb
Overview
typed: true frozen_string_literal: true
Instance Attribute Summary collapse
-
#date ⇒ Object
Returns the value of attribute date.
-
#date_filter_type ⇒ Object
Returns the value of attribute date_filter_type.
-
#emails ⇒ Object
Returns the value of attribute emails.
-
#end_date ⇒ Object
Returns the value of attribute end_date.
-
#ex_url ⇒ Object
Returns the value of attribute ex_url.
-
#pdf_url ⇒ Object
Returns the value of attribute pdf_url.
-
#restaurant_id ⇒ Object
Returns the value of attribute restaurant_id.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
Methods inherited from ApplicationWorker
Instance Attribute Details
#date ⇒ Object
Returns the value of attribute date.
10 11 12 |
# File 'app/workers/notification_workers/partner/performance_review_report.rb', line 10 def date @date end |
#date_filter_type ⇒ Object
Returns the value of attribute date_filter_type.
10 11 12 |
# File 'app/workers/notification_workers/partner/performance_review_report.rb', line 10 def date_filter_type @date_filter_type end |
#emails ⇒ Object
Returns the value of attribute emails.
10 11 12 |
# File 'app/workers/notification_workers/partner/performance_review_report.rb', line 10 def emails @emails end |
#end_date ⇒ Object
Returns the value of attribute end_date.
10 11 12 |
# File 'app/workers/notification_workers/partner/performance_review_report.rb', line 10 def end_date @end_date end |
#ex_url ⇒ Object
Returns the value of attribute ex_url.
10 11 12 |
# File 'app/workers/notification_workers/partner/performance_review_report.rb', line 10 def ex_url @ex_url end |
#pdf_url ⇒ Object
Returns the value of attribute pdf_url.
10 11 12 |
# File 'app/workers/notification_workers/partner/performance_review_report.rb', line 10 def pdf_url @pdf_url end |
#restaurant_id ⇒ Object
Returns the value of attribute restaurant_id.
10 11 12 |
# File 'app/workers/notification_workers/partner/performance_review_report.rb', line 10 def restaurant_id @restaurant_id end |
#start_date ⇒ Object
Returns the value of attribute start_date.
10 11 12 |
# File 'app/workers/notification_workers/partner/performance_review_report.rb', line 10 def start_date @start_date end |
#type ⇒ Object
Returns the value of attribute type.
10 11 12 |
# File 'app/workers/notification_workers/partner/performance_review_report.rb', line 10 def type @type end |
Instance Method Details
#perform(args, attachment_id = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/workers/notification_workers/partner/performance_review_report.rb', line 14 def perform(args, = nil) total 100 store status: Attachment::ON_PROGRESS_STATUS store email_status: Attachment::PENDING_EMAIL_STATUS at 0 self. = Attachment.find_by(id: ) if .present? return if .blank? .update(status: :on_progress) begin args.to_h.with_indifferent_access.each do |k, v| next if k.to_s == :use_long_process.to_s send("#{k}=".to_sym, v) end I18n.locale = :en if pdf? report = PerformanceReviewReportPdf.new(args) report.generate_pdf(args) self.pdf_url = report.pdf_url else generate_excel end at(90) OwnerMailer.performance_review_report(email_body, email_subject, emails).deliver_later! store email_status: Attachment::SENT_EMAIL_STATUS rescue Aws::SES::Errors::Throttling => e store email_status: Attachment::FAILED_EMAIL_STATUS store message: "Email sending failed due to AWS SES throttling. Error: #{e.}" raise e rescue StandardError => e store email_status: Attachment::FAILED_EMAIL_STATUS store message: "An error occurred: #{e.}" store status: Attachment::FAILED_STATUS if .blank? || .download_link.blank? APMErrorHandler.report e raise e end end |