Class: GenerateReportJob

Inherits:
Struct
  • Object
show all
Defined in:
app/jobs/generate_report_job.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#report_idObject

Returns the value of attribute report_id

Returns:

  • (Object)

    the current value of report_id



1
2
3
# File 'app/jobs/generate_report_job.rb', line 1

def report_id
  @report_id
end

#requeueObject

Returns the value of attribute requeue

Returns:

  • (Object)

    the current value of requeue



1
2
3
# File 'app/jobs/generate_report_job.rb', line 1

def requeue
  @requeue
end

Instance Method Details

#enqueue(job) ⇒ Object



3
4
5
# File 'app/jobs/generate_report_job.rb', line 3

def enqueue(job)
  job.report_id = self.report_id
end

#performObject



11
12
13
14
15
16
# File 'app/jobs/generate_report_job.rb', line 11

def perform
  return if report.nil?
  return if report.archived?
  report.generate!
  report.queue_next! if requeue
end

#reportObject



7
8
9
# File 'app/jobs/generate_report_job.rb', line 7

def report
  @daily_report ||= DailyReport.find_by_id(report_id)
end