Class: Decidim::Forms::ExportQuestionnaireAnswersJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
decidim-forms/app/jobs/decidim/forms/export_questionnaire_answers_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(user, title, answers) ⇒ Object


8
9
10
11
12
13
14
15
16
# File 'decidim-forms/app/jobs/decidim/forms/export_questionnaire_answers_job.rb', line 8

def perform(user, title, answers)
  return if user&.email.blank?
  return if answers.blank?

  serializer = Decidim::Forms::UserAnswersSerializer
  export_data = Decidim::Exporters::FormPDF.new(answers, serializer).export

  ExportMailer.export(user, title, export_data).deliver_now
end