Class: Decidim::Elections::Admin::ProcessCensus

Inherits:
Commands::UpdateResource show all
Defined in:
decidim-elections/app/commands/decidim/elections/admin/process_census.rb

Overview

A command with the business logic to create census data for an election.

Instance Method Summary collapse

Methods inherited from Commands::UpdateResource

#call, #initialize

Methods inherited from Command

call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events

Constructor Details

This class inherits a constructor from Decidim::Commands::UpdateResource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Decidim::Command

Instance Method Details

#attributesObject



9
10
11
12
13
14
# File 'decidim-elections/app/commands/decidim/elections/admin/process_census.rb', line 9

def attributes
  {
    census_manifest: resource.census.name,
    census_settings: census_settings
  }
end

#census_settingsObject



24
25
26
27
28
# File 'decidim-elections/app/commands/decidim/elections/admin/process_census.rb', line 24

def census_settings
  return {} unless form.respond_to?(:census_settings)

  form.census_settings
end

#run_after_hooksObject

This will run any post-processing hooks defined in the census manifest



17
18
19
20
21
22
# File 'decidim-elections/app/commands/decidim/elections/admin/process_census.rb', line 17

def run_after_hooks
  command = resource.census.after_update_command&.safe_constantize
  return unless command

  command.call(form, resource)
end