demarches-normaliennes/app/helpers/archive_helper.rb
Christophe Robillard 41569efe9d extract estimate_weight
and rename nb_dossiers by nb_dossiers_termines
2021-06-09 10:52:38 +02:00

13 lines
381 B
Ruby

module ArchiveHelper
def can_generate_archive?(dossiers_termines, poids_total)
dossiers_termines.count < 100 && poids_total < 1.gigabyte
end
def estimate_weight(archive, nb_dossiers_termines, average_dossier_weight)
if archive.present? && archive.available?
archive.file.byte_size
else
nb_dossiers_termines * average_dossier_weight
end
end
end