allow download whole procedure if small enough

Co-authored-by: Christophe Robillard <christophe.robillard@beta.gouv.fr>
This commit is contained in:
simon lehericey 2021-05-26 17:49:24 +02:00 committed by Christophe Robillard
parent 1c1e990d2a
commit 7cce505dce

View file

@ -32,15 +32,15 @@
%tbody %tbody
%tr %tr
- matching_archive = @archives.find { |archive| archive.time_span_type == 'everything' } - matching_archive = @archives.find { |archive| archive.time_span_type == 'everything' }
- if matching_archive.present? && matching_archive.available?
- weight = matching_archive.file.byte_size
- else
- weight = @poids_total
%td %td
Tous les dossiers Tous les dossiers
%td %td
= @nb_dossiers = @nb_dossiers
%td %td
- if matching_archive.present? && matching_archive.available?
- weight = matching_archive.file.byte_size
- else
- weight = @poids_total
= number_to_human_size(weight) = number_to_human_size(weight)
%td %td
- if matching_archive.try(&:available?) - if matching_archive.try(&:available?)
@ -50,12 +50,14 @@
- elsif matching_archive.try(&:pending?) - elsif matching_archive.try(&:pending?)
%span.icon.retry %span.icon.retry
= t(:archive_pending_html, created_period: time_ago_in_words(matching_archive.created_at), scope: [:instructeurs, :procedure]) = t(:archive_pending_html, created_period: time_ago_in_words(matching_archive.created_at), scope: [:instructeurs, :procedure])
- elsif @nb_dossiers > 0 - elsif @nb_dossiers == 0
Rien à télécharger !
- elsif weight < 1.gigabyte
= link_to instructeur_archives_path(@procedure, type: 'everything'), method: :post, class: "button" do = link_to instructeur_archives_path(@procedure, type: 'everything'), method: :post, class: "button" do
%span.icon.new-folder %span.icon.new-folder
Demander la création Demander la création
- else - else
Rien à télécharger ! Archive trop volumineuse
- @count_dossiers_termines_by_month.each do |count_by_month| - @count_dossiers_termines_by_month.each do |count_by_month|
- month = count_by_month["month"].to_date - month = count_by_month["month"].to_date
- nb_dossiers_termines = count_by_month["count"] - nb_dossiers_termines = count_by_month["count"]