diff --git a/app/controllers/users/commencer_controller.rb b/app/controllers/users/commencer_controller.rb
index f825938cb..5ae8a0a36 100644
--- a/app/controllers/users/commencer_controller.rb
+++ b/app/controllers/users/commencer_controller.rb
@@ -20,6 +20,8 @@ module Users
check_prefilled_dossier_ownership if @prefilled_dossier
end
+ @usual_traitement_time = @procedure.stats_usual_traitement_time
+
render 'commencer/show'
end
diff --git a/app/views/shared/_procedure_description.html.haml b/app/views/shared/_procedure_description.html.haml
index 27f4e266f..1ca1d8504 100644
--- a/app/views/shared/_procedure_description.html.haml
+++ b/app/views/shared/_procedure_description.html.haml
@@ -69,12 +69,22 @@
= pj.libelle
= t('utils.no_mandatory') if !pj.mandatory?
- - if procedure.persisted? && procedure.estimated_duration_visible?
+ - if @usual_traitement_time.present?
%section.fr-accordion
%h2.fr-accordion__title
%button.fr-accordion__btn{ "aria-controls" => "accordion-117", "aria-expanded" => "false" }
- = t('shared.procedure_description.estimated_fill_duration_title')
+ = t('shared.procedure_description.usual_traitement_time_title')
+
#accordion-117.fr-collapse
+ = t('shared.procedure_description.usual_traitement_time_detail_html', traitement_time: distance_of_time_in_words(@usual_traitement_time), percentile: ProcedureStatsConcern::USUAL_TRAITEMENT_TIME_PERCENTILE, days: ProcedureStatsConcern::NB_DAYS_RECENT_DOSSIERS, href: statistiques_path(procedure.path) )
+
+
+ - if procedure.persisted? && procedure.estimated_duration_visible?
+ %section.fr-accordion
+ %h2.fr-accordion__title
+ %button.fr-accordion__btn{ "aria-controls" => "accordion-118", "aria-expanded" => "false" }
+ = t('shared.procedure_description.estimated_fill_duration_title')
+ #accordion-118.fr-collapse
= t('shared.procedure_description.estimated_fill_duration_detail', estimated_minutes: estimated_fill_duration_minutes(procedure))
.fr-my-3w
@@ -89,4 +99,3 @@
= t('shared.procedure_description.sva_svr_prevision_date',
delay: t("x_#{procedure.sva_svr_configuration.unit}", count: procedure.sva_svr_configuration.period.to_i, scope: 'datetime.distance_in_words'),
date: l(SVASVRDecisionDateCalculatorService.decision_date_from_today(procedure), format: :long).gsub(' ', " "))
-
diff --git a/config/locales/en.yml b/config/locales/en.yml
index b26f2de22..5d16edd13 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -849,6 +849,8 @@ en:
estimated_fill_duration: "Estimated fill time: %{estimated_minutes} mn"
estimated_fill_duration_title: What is the procedure estimated fill time ?
estimated_fill_duration_detail: "The fill time is etimated to %{estimated_minutes} min. This period may vary depending on the options you choose"
+ usual_traitement_time_title: What are the processing times for this procedure?
+ usual_traitement_time_detail_html: Usually, files in this procedure are processed within %{traitement_time}. This estimate is calculated automatically from the processing times observed on %{percentile}% of requests that have been processed during the last %{days} days. Actual lead time may vary. For more information, you can consult the statistics page of this procedure.
pieces_jointes : What are the required attachments ?
pieces_jointes_conditionnal_list_title : Attachments list according to your situation
sva_svr_title: "This procedure applies the « %{rule} »"
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index a9bd26108..99c2f7102 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -904,6 +904,8 @@ fr:
estimated_fill_duration: "Temps de remplissage estimé : %{estimated_minutes} mn"
estimated_fill_duration_title: Quelle est la durée de remplissage de la démarche ?
estimated_fill_duration_detail: "La durée de remplissage est estimée à %{estimated_minutes} min. Ce délai peut varier selon les options que vous choisirez."
+ usual_traitement_time_title: Quels sont des délais d'instruction pour cette démarche ?
+ usual_traitement_time_detail_html: Habituellement, les dossiers de cette démarche sont traités dans un délai de %{traitement_time}. Cette estimation est calculée automatiquement à partir des délais d’instruction constatés sur %{percentile}% des demandes qui ont été traitées lors des %{days} derniers jours. Le délai réel peut être différent. Pour plus d'informations, vous pouvez consulter la page statistiques de cette démarche.
pieces_jointes : Quelles sont les pièces justificatives à fournir ?
pieces_jointes_conditionnal_list_title : Liste des pièces en fonction de votre situation
sva_svr_title: "Cette démarche applique le « %{rule} »"
diff --git a/spec/views/shared/_procedure_description.html.haml_spec.rb b/spec/views/shared/_procedure_description.html.haml_spec.rb
index d3a2375bf..0e1c13e32 100644
--- a/spec/views/shared/_procedure_description.html.haml_spec.rb
+++ b/spec/views/shared/_procedure_description.html.haml_spec.rb
@@ -47,6 +47,16 @@ describe 'shared/_procedure_description', type: :view do
end
end
+ context 'when procedure has usual_traitement_time' do
+ before { assign(:usual_traitement_time, 1.day) }
+
+ it 'shows a usual traitement text' do
+ subject
+ expect(rendered).to have_text("Quels sont des délais d'instruction pour cette démarche ?")
+ expect(rendered).to have_text("Habituellement, les dossiers de cette démarche sont traités dans un délai de 1 jour.")
+ end
+ end
+
context 'when the procedure has pieces jointes' do
let(:procedure) { create(:procedure, :draft, :with_titre_identite, :with_piece_justificative, :with_siret) }
it 'shows the pieces jointes list for draft procedure' do