Sha256: 3d0b37e9bd4906d237c8e068af0edeb823032af9db78840344a7443299d6ea87

Contents?: true

Size: 858 Bytes

Versions: 4

Compression:

Stored size: 858 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ActionDelegator
    module Admin
      class ImportCsvJob < ApplicationJob
        queue_as :exports

        def perform(importer_type, csv_file, current_user, current_setting)
          importer = if importer_type == "DelegationsCsvImporter"
                       Decidim::ActionDelegator::DelegationsCsvImporter.new(csv_file, current_user, current_setting)
                     else
                       Decidim::ActionDelegator::ParticipantsCsvImporter.new(csv_file, current_user, current_setting)
                     end

          import_summary = importer.import!

          Decidim::ActionDelegator::ImportMailer
            .import(current_user, import_summary, import_summary[:details_csv_path])
            .deliver_later

          import_summary
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-action_delegator-0.8.1 app/jobs/decidim/action_delegator/admin/import_csv_job.rb
decidim-action_delegator-0.7.2 app/jobs/decidim/action_delegator/admin/import_csv_job.rb
decidim-action_delegator-0.7.1 app/jobs/decidim/action_delegator/admin/import_csv_job.rb
decidim-action_delegator-0.7.0 app/jobs/decidim/action_delegator/admin/import_csv_job.rb