Sha256: e5c552d980246a56c83c2039010fd86e765232567af0bd31fddb73693f16a137
Contents?: true
Size: 800 Bytes
Versions: 13
Compression:
Stored size: 800 Bytes
Contents
# frozen_string_literal: true module Decidim module Initiatives class ExportInitiativesJob < ApplicationJob queue_as :exports def perform(user, organization, format, collection_ids = nil) export_data = Decidim::Exporters.find_exporter(format).new( collection_to_export(collection_ids, organization), serializer ).export ExportMailer.export(user, "initiatives", export_data).deliver_now end private def collection_to_export(ids, organization) collection = Decidim::Initiative.where(organization:) collection = collection.where(id: ids) if ids.present? collection.order(id: :asc) end def serializer Decidim::Initiatives::InitiativeSerializer end end end end
Version data entries
13 entries across 13 versions & 1 rubygems