2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-04-29 17:29:47 +02:00
|
|
|
module ArchiveHelper
|
|
|
|
def can_generate_archive?(dossiers_termines, poids_total)
|
|
|
|
dossiers_termines.count < 100 && poids_total < 1.gigabyte
|
|
|
|
end
|
2021-06-01 09:42:07 +02:00
|
|
|
|
|
|
|
def estimate_weight(archive, nb_dossiers_termines, average_dossier_weight)
|
|
|
|
if archive.present? && archive.available?
|
|
|
|
archive.file.byte_size
|
2022-07-27 12:13:59 +02:00
|
|
|
elsif !average_dossier_weight.nil?
|
2021-06-01 09:42:07 +02:00
|
|
|
nb_dossiers_termines * average_dossier_weight
|
|
|
|
end
|
|
|
|
end
|
2021-04-29 17:29:47 +02:00
|
|
|
end
|