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
def estimate_fill_duration
estimate = if @procedure.feature_enabled?(:procedure_estimated_fill_duration)
@procedure.draft_revision.estimated_fill_duration
else
0
end
estimate = @procedure.draft_revision.estimated_fill_duration
render json: { estimated_fill_duration: estimate }
end

View file

@ -38,7 +38,7 @@ module ProcedureHelper
baseUrl: admin_procedure_types_de_champ_path(procedure),
directUploadUrl: rails_direct_uploads_url,
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

View file

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

View file

@ -26,7 +26,6 @@ features = [
:hide_instructeur_email,
:procedure_revisions,
:procedure_routage_api,
:procedure_estimated_fill_duration,
: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')
end
context "when the estimated fill duration is enabled" do
before { Flipper.enable(:procedure_estimated_fill_duration) }
after { Flipper.disable(:procedure_estimated_fill_duration) }
scenario "displaying the estimated fill duration" do
# It doesn't display anything when there are no champs
expect(page).not_to have_content('Durée de remplissage estimé')
scenario "displaying the estimated fill duration" do
# It doesn't display anything when there are no champs
expect(page).not_to have_content('Durée de remplissage estimé')
# It displays the estimate when adding a new champ
add_champ
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
add_champ
select('Pièce justificative', from: 'champ-0-type_champ')
expect(page).to have_content('Durée de remplissage estimée : 1 mn')
# It updates the estimate when updating the champ
check 'Obligatoire'
expect(page).to have_content('Durée de remplissage estimée : 3 mn')
# It updates the estimate when updating the champ
check 'Obligatoire'
expect(page).to have_content('Durée de remplissage estimée : 3 mn')
# 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')
# 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

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_text(procedure.libelle)
expect(rendered).to have_text(procedure.description)
expect(rendered).to have_text('Temps de remplissage estimé')
end
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')
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