PiecesJustificativesService: more explicit selection of content

This commit is contained in:
Simon Lehericey 2017-04-19 10:24:08 +02:00
parent 21d7a96062
commit 71542f6a3a

View file

@ -2,7 +2,7 @@ class PiecesJustificativesService
def self.upload!(dossier, user, params) def self.upload!(dossier, user, params)
tpj_contents = dossier.types_de_piece_justificative tpj_contents = dossier.types_de_piece_justificative
.map { |tpj| [tpj, params["piece_justificative_#{tpj.id}"]] } .map { |tpj| [tpj, params["piece_justificative_#{tpj.id}"]] }
.select { |_, content| content } .select { |_, content| content.present? }
without_virus, with_virus = tpj_contents without_virus, with_virus = tpj_contents
.partition { |_, content| ClamavService.safe_file?(content.path) } .partition { |_, content| ClamavService.safe_file?(content.path) }