Class: Decidim::Surveys::CleanSurveyAnswersJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
decidim-surveys/app/jobs/decidim/surveys/clean_survey_answers_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(_event_name, data) ⇒ Object


6
7
8
9
10
11
12
13
14
15
16
17
# File 'decidim-surveys/app/jobs/decidim/surveys/clean_survey_answers_job.rb', line 6

def perform(_event_name, data)
  @component = data[:resource]
  return unless component&.manifest_name == "surveys"

  @survey = Survey.find_by(component: component)
  return unless survey&.questionnaire

  case data[:event_class]
  when "Decidim::ComponentPublishedEvent"
    clean_answers
  end
end