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

Inherits:
Commands::UpdateResource
  • Object
show all
Defined in:
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

Instance Method Details

#attributesObject



9
10
11
12
13
14
# File '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 '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 '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