Class: Decidim::ParticipatoryDocuments::ExportMySuggestionsJob

Inherits:
ExportJob
  • Object
show all
Defined in:
app/jobs/decidim/participatory_documents/export_my_suggestions_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(user, document, format) ⇒ Object



6
7
8
9
10
11
12
13
# File 'app/jobs/decidim/participatory_documents/export_my_suggestions_job.rb', line 6

def perform(user, document, format)
  export_manifest = document.component.manifest.export_manifests.find { |manifest| manifest.name == :suggestions }
  collection = export_manifest.collection.call(document.component, user, :my_suggestions)

  export_data = Decidim::Exporters.find_exporter(format).new(collection, MySuggestionSerializer).export

  ExportMailer.export(user, :suggestions, export_data).deliver_now
end