chore(dossier): cleanup clone champ

This commit is contained in:
Paul Chavard 2022-11-22 15:14:32 +01:00
parent aa5f11e077
commit 7a35a253a0

View file

@ -217,7 +217,7 @@ class Champ < ApplicationRecord
end
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])
kopy.dossier = dossier
@ -233,18 +233,6 @@ class Champ < ApplicationRecord
kopy
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
def champs_for_condition