Class: Decidim::Verifications::CsvCensus::RemoveDuplicatesJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/decidim/verifications/csv_census/remove_duplicates_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(organization) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'app/jobs/decidim/verifications/csv_census/remove_duplicates_job.rb', line 9

def perform(organization)
  duplicated_census(organization).pluck(:email).each do |email|
    CsvDatum.inside(organization)
            .where(email:)
            .order(id: :desc)
            .all(1..-1)
            .each(&:delete)
  end
end