Merge pull request #7435 from betagouv/remove-procedure-estimated-fill-time-feature-flag

Technique : activation de l'estimation de la durée de remplissage pour toutes les démarches, et suppression du feature-flag `procedure-estimated-fill-time`
This commit is contained in:
Pierre de La Morinerie 2022-06-01 15:06:13 +02:00 committed by GitHub
commit e44a6ddeea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 34 deletions

View file

@ -32,11 +32,7 @@ module Administrateurs
end end
def estimate_fill_duration def estimate_fill_duration
estimate = if @procedure.feature_enabled?(:procedure_estimated_fill_duration) estimate = @procedure.draft_revision.estimated_fill_duration
@procedure.draft_revision.estimated_fill_duration
else
0
end
render json: { estimated_fill_duration: estimate } render json: { estimated_fill_duration: estimate }
end end

View file

@ -38,7 +38,7 @@ module ProcedureHelper
baseUrl: admin_procedure_types_de_champ_path(procedure), baseUrl: admin_procedure_types_de_champ_path(procedure),
directUploadUrl: rails_direct_uploads_url, directUploadUrl: rails_direct_uploads_url,
continuerUrl: admin_procedure_path(procedure), continuerUrl: admin_procedure_path(procedure),
estimatedFillDuration: procedure.feature_enabled?(:procedure_estimated_fill_duration) ? procedure.draft_revision.estimated_fill_duration : 0 estimatedFillDuration: procedure.draft_revision.estimated_fill_duration
} }
end end

View file

@ -8,7 +8,7 @@
%h1.procedure-title %h1.procedure-title
= procedure.libelle = procedure.libelle
- if procedure.persisted? && procedure.feature_enabled?(:procedure_estimated_fill_duration) - if procedure.persisted?
%p.procedure-configuration.procedure-configuration--fill-duration %p.procedure-configuration.procedure-configuration--fill-duration
%span.icon.clock %span.icon.clock
= t('shared.procedure_description.estimated_fill_duration', estimated_minutes: estimated_fill_duration_minutes(procedure)) = t('shared.procedure_description.estimated_fill_duration', estimated_minutes: estimated_fill_duration_minutes(procedure))

View file

@ -26,7 +26,6 @@ features = [
:hide_instructeur_email, :hide_instructeur_email,
:procedure_revisions, :procedure_revisions,
:procedure_routage_api, :procedure_routage_api,
:procedure_estimated_fill_duration,
:procedure_process_expired_dossiers_termine :procedure_process_expired_dossiers_termine
] ]

View file

@ -144,28 +144,23 @@ describe 'As an administrateur I can edit types de champ', js: true do
expect(page).to have_content('Un menu') expect(page).to have_content('Un menu')
end end
context "when the estimated fill duration is enabled" do scenario "displaying the estimated fill duration" do
before { Flipper.enable(:procedure_estimated_fill_duration) } # It doesn't display anything when there are no champs
after { Flipper.disable(:procedure_estimated_fill_duration) } expect(page).not_to have_content('Durée de remplissage estimé')
scenario "displaying the estimated fill duration" do # It displays the estimate when adding a new champ
# It doesn't display anything when there are no champs add_champ
expect(page).not_to have_content('Durée de remplissage estimé') select('Pièce justificative', from: 'champ-0-type_champ')
expect(page).to have_content('Durée de remplissage estimée : 1 mn')
# It displays the estimate when adding a new champ # It updates the estimate when updating the champ
add_champ check 'Obligatoire'
select('Pièce justificative', from: 'champ-0-type_champ') expect(page).to have_content('Durée de remplissage estimée : 3 mn')
expect(page).to have_content('Durée de remplissage estimée : 1 mn')
# It updates the estimate when updating the champ # It updates the estimate when removing the champ
check 'Obligatoire' page.accept_alert do
expect(page).to have_content('Durée de remplissage estimée : 3 mn') click_on 'Supprimer'
# It updates the estimate when removing the champ
page.accept_alert do
click_on 'Supprimer'
end
expect(page).not_to have_content('Durée de remplissage estimée')
end end
expect(page).not_to have_content('Durée de remplissage estimée')
end end
end end

View file

@ -8,6 +8,7 @@ describe 'shared/_procedure_description.html.haml', type: :view do
expect(rendered).to have_selector('.procedure-logos') expect(rendered).to have_selector('.procedure-logos')
expect(rendered).to have_text(procedure.libelle) expect(rendered).to have_text(procedure.libelle)
expect(rendered).to have_text(procedure.description) expect(rendered).to have_text(procedure.description)
expect(rendered).to have_text('Temps de remplissage estimé')
end end
it 'does not show empty date limite' do it 'does not show empty date limite' do
@ -22,11 +23,4 @@ describe 'shared/_procedure_description.html.haml', type: :view do
expect(rendered).to have_text('Date limite') expect(rendered).to have_text('Date limite')
end end
end end
context 'when the procedure_estimated_fill_duration feature is enabled' do
before { Flipper.enable(:procedure_estimated_fill_duration) }
after { Flipper.disable(:procedure_estimated_fill_duration) }
it { is_expected.to have_text('Temps de remplissage estimé') }
end
end end