Sha256: ef3101b364c4a60641fdd78ab98ebea33e06b6e1500a30a457895b837dfc5c6c
Contents?: true
Size: 983 Bytes
Versions: 18
Compression:
Stored size: 983 Bytes
Contents
# frozen_string_literal: true module Decidim module Votings module Census module Admin # A command to launch the access codes export class LaunchAccessCodesExport < Decidim::Command def initialize(dataset, user) @dataset = dataset @user = user end # Executes the command. Broadcast this events: # - :ok when everything is valid # - :invalid when the user is not present # # Returns nothing. def call return broadcast(:invalid) unless valid? UpdateDataset.call(dataset, { status: :exporting_codes }, user) ExportAccessCodesJob.perform_later(dataset, user) broadcast(:ok) end attr_reader :user, :dataset private def valid? user.present? && dataset&.data&.exists? && dataset.codes_generated? end end end end end end
Version data entries
18 entries across 18 versions & 1 rubygems