9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'app/jobs/decidim/accountability/admin/import_projects_job.rb', line 9
def perform(projects, component, user)
projects.map do |id|
original_project = Decidim::Budgets::Project.find_by(id:)
new_result = create_result_from_project!(original_project, statuses(component).first, component, user)
new_result.link_resources([original_project], "included_projects")
new_result.link_resources(
original_project.linked_resources(:proposals, "included_proposals"),
"included_proposals"
)
copy_attachments(original_project, new_result)
end.compact
Decidim::Accountability::ImportProjectsMailer.import(user, component, projects.count).deliver_now
end
|