10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'app/jobs/decidim/votings/census/admin/export_access_codes_job.rb', line 10
def perform(dataset, user)
filename = "#{SecureRandom.urlsafe_base64}.zip"
path = Rails.root.join("tmp/#{filename}")
password = SecureRandom.urlsafe_base64
ActiveRecord::Base.transaction do
UpdateDataset.call(dataset, { status: :exporting_codes }, user)
generate_zip_file(dataset, path, password)
save_or_upload_file(dataset, path)
ExportMailer.access_codes_export(user, dataset.voting, filename, password).deliver_later
UpdateDataset.call(dataset, { status: :freeze }, user)
end
end
|