Sha256: c012e3dcb51863af2db90e0cf10029b5d1dcffe0ff0bbeb4434039151671dacf

Contents?: true

Size: 673 Bytes

Versions: 13

Compression:

Stored size: 673 Bytes

Contents

# frozen_string_literal: true

module Decidim
  class ExportJob < ApplicationJob
    queue_as :default

    def perform(user, feature, name, format)
      export_manifest = feature.manifest.export_manifests.find do |manifest|
        manifest.name == name.to_sym
      end

      collection = export_manifest.collection.call(feature)
      serializer = export_manifest.serializer

      export_data = Decidim::Exporters.const_get(format.upcase).new(collection, serializer).export

      name = "#{name}-#{I18n.localize(Date.today, format: :default)}-#{Time.now.seconds_since_midnight.to_i}"

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

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
decidim-core-0.5.1 app/jobs/decidim/export_job.rb
decidim-0.5.1 decidim-core/app/jobs/decidim/export_job.rb
decidim-core-0.5.0 app/jobs/decidim/export_job.rb
decidim-0.5.0 decidim-core/app/jobs/decidim/export_job.rb
decidim-core-0.4.4 app/jobs/decidim/export_job.rb
decidim-core-0.4.2 app/jobs/decidim/export_job.rb
decidim-core-0.4.1 app/jobs/decidim/export_job.rb
decidim-core-0.4.3 app/jobs/decidim/export_job.rb
decidim-core-0.4.0 app/jobs/decidim/export_job.rb
decidim-core-0.3.2 app/jobs/decidim/export_job.rb
decidim-core-0.3.1 app/jobs/decidim/export_job.rb
decidim-core-0.3.0 app/jobs/decidim/export_job.rb
decidim-core-0.2.0 app/jobs/decidim/export_job.rb