chore(dossier): cleanup clone champ
This commit is contained in:
parent
aa5f11e077
commit
7a35a253a0
1 changed files with 1 additions and 13 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue