Sha256: fdcf3ce9babf1ab89f0829f0eed2e7302cedec26a0423b9952d5a4edc856fe65
Contents?: true
Size: 1.15 KB
Versions: 8
Compression:
Stored size: 1.15 KB
Contents
# frozen_string_literal: true module Decidim module ActionDelegator class ExportConsultationResultsJob < ApplicationJob queue_as :default def perform(user, consultation, results_type) @consultation = consultation @results_type = results_type.to_sym export_data = Decidim::Exporters .find_exporter("CSV") .new(collection, serializer) .export Decidim::ExportMailer.export(user, filename, export_data).deliver_now end private attr_reader :consultation, :results_type def collection query_class.new(consultation).query end def query_class case results_type when :sum_of_weights SumOfWeights when :type_and_weight TypeAndWeight end end def serializer case results_type when :sum_of_weights SumOfWeightsSerializer when :type_and_weight ConsultationResultsSerializer end end def filename I18n.t("decidim.admin.consultations.results.export_filename") end end end end
Version data entries
8 entries across 8 versions & 1 rubygems