Merge pull request #8099 from tchak/remove-dead-code

chore(dossier): cleanup clone champ
This commit is contained in:
Paul Chavard 2022-11-24 16:32:53 +01:00 committed by GitHub
commit 885d4ea997
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -217,7 +217,7 @@ class Champ < ApplicationRecord
end end
def clone(dossier:, parent: nil) def clone(dossier:, parent: nil)
kopy = deep_clone(only: (private? ? [] : [:value, :value_json]) + [:data, :private, :row, :type, :external_id, :type_de_champ_id], kopy = deep_clone(only: (private? ? [] : [:value, :value_json, :data, :external_id]) + [:private, :row, :type, :type_de_champ_id],
include: private? ? [] : [:etablissement, :geo_areas]) include: private? ? [] : [:etablissement, :geo_areas])
kopy.dossier = dossier kopy.dossier = dossier
@ -233,18 +233,6 @@ class Champ < ApplicationRecord
kopy kopy
end end
def clone_piece_justificative(kopy)
piece_justificative_file.open do |tempfile|
kopy.piece_justificative_file.attach({
io: File.open(tempfile.path),
filename: piece_justificative_file.filename,
content_type: piece_justificative_file.content_type,
metadata: { virus_scan_result: ActiveStorage::VirusScanner::SAFE }
})
end
rescue ActiveStorage::FileNotFoundError, ActiveStorage::IntegrityError
end
private private
def champs_for_condition def champs_for_condition