extract operation_logs_and_signatures method

This commit is contained in:
simon lehericey 2022-04-01 16:21:38 +02:00
parent 9414d499b8
commit 437e871f79

View file

@ -146,13 +146,19 @@ class PiecesJustificativesService
].flatten.compact
if !for_expert
bill_signatures = dossier.dossier_operation_logs.filter_map(&:bill_signature).uniq
pjs += [
dossier.dossier_operation_logs.map(&:serialized),
bill_signatures.map(&:serialized),
bill_signatures.map(&:signature)
].flatten.compact
pjs += operation_logs_and_signatures(dossier)
end
pjs
end
def self.operation_logs_and_signatures(dossier)
bill_signatures = dossier.dossier_operation_logs.filter_map(&:bill_signature).uniq
[
dossier.dossier_operation_logs.map(&:serialized),
bill_signatures.map(&:serialized),
bill_signatures.map(&:signature)
].flatten.compact
end
end