Merge pull request #9037 from demarches-simplifiees/fix-bug-alert-batch-incrementation

[Fix] Actions multiples - Corriger le compteur dans les alertes + ajouter des infos sur le créateur du batch
This commit is contained in:
Colin Darie 2023-05-15 10:32:31 +00:00 committed by GitHub
commit d3028f5570
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 17 deletions

View file

@ -7,7 +7,7 @@ en:
in_progress:
text_success:
one: 1/1 is being archived
other: "%{progress_count}/%{count} files have been archived"
other: "%{success_count}/%{count} files have been archived"
passer_en_instruction:
finish:
text_success:
@ -16,7 +16,7 @@ en:
in_progress:
text_success:
one: 1/1 is being changed to instructing
other: "%{progress_count}/%{count} files have been changed to instructing"
other: "%{success_count}/%{count} files have been changed to instructing"
accepter:
finish:
text_success:
@ -25,7 +25,7 @@ en:
in_progress:
text_success:
one: 1/1 is being accepted
other: "%{progress_count}/%{count} files have been accepted"
other: "%{success_count}/%{count} files have been accepted"
follow:
finish:
text_success:
@ -34,7 +34,7 @@ en:
in_progress:
text_success:
one: 1/1 is being followed
other: "%{progress_count}/%{count} files have been followed"
other: "%{success_count}/%{count} files have been followed"
unfollow:
finish:
text_success:
@ -43,7 +43,7 @@ en:
in_progress:
text_success:
one: 1/1 is being unfollowed
other: "%{progress_count}/%{count} files have been unfollowed"
other: "%{success_count}/%{count} files have been unfollowed"
repasser_en_construction:
finish:
text_success:
@ -52,9 +52,10 @@ en:
in_progress:
text_success:
one: 1/1 is being changed to in progress
other: "%{progress_count}/%{count} files have been changed to in progress"
other: "%{success_count}/%{count} files have been changed to in progress"
title:
finish: The bulk action is finished
in_progress: A bulk action is processing
link_text: Refresh this webpage
after_link_text: to check if the process is over.
context: This bulk action was created by %{mail}, %{time_ago}

View file

@ -7,7 +7,7 @@ fr:
in_progress:
text_success:
one: 1 dossier sera archivé
other: "%{progress_count}/%{count} dossiers ont été archivés"
other: "%{success_count}/%{count} dossiers ont été archivés"
passer_en_instruction:
finish:
text_success:
@ -16,7 +16,7 @@ fr:
in_progress:
text_success:
one: 1 dossier sera passé en instruction
other: "%{progress_count}/%{count} dossiers ont été passés en instruction"
other: "%{success_count}/%{count} dossiers ont été passés en instruction"
accepter:
finish:
text_success:
@ -25,7 +25,7 @@ fr:
in_progress:
text_success:
one: 1 dossier sera accepté
other: "%{progress_count}/%{count} dossiers ont été acceptés"
other: "%{success_count}/%{count} dossiers ont été acceptés"
follow:
finish:
text_success:
@ -34,7 +34,7 @@ fr:
in_progress:
text_success:
one: 1 dossier sera suivi
other: "%{progress_count}/%{count} dossiers ont été suivis"
other: "%{success_count}/%{count} dossiers ont été suivis"
unfollow:
finish:
text_success:
@ -43,7 +43,7 @@ fr:
in_progress:
text_success:
one: 1 dossier ne sera plus suivi
other: "%{progress_count}/%{count} dossiers ne sont plus suivis"
other: "%{success_count}/%{count} dossiers ne sont plus suivis"
repasser_en_construction:
finish:
text_success:
@ -52,9 +52,10 @@ fr:
in_progress:
text_success:
one: 1 dossier sera repassé en construction
other: "%{progress_count}/%{count} dossiers ont été repassés en construction"
other: "%{success_count}/%{count} dossiers ont été repassés en construction"
title:
finish: L'action de masse est terminée
in_progress: Une action de masse est en cours
link_text: Recharger la page
after_link_text: pour voir si l'opération est finie.
context: Cette opération a été lancée par %{mail}, il y a %{time_ago}

View file

@ -9,8 +9,11 @@
- else
= render Dsfr::AlertComponent.new(title: t(".title.in_progress"), state: :info, heading_level: 'h2') do |c|
- c.body do
%p= t(".#{batch.operation}.in_progress.text_success", count: @batch.total_count, progress_count: @batch.progress_count)
%p= t(".#{batch.operation}.in_progress.text_success", count: @batch.total_count, success_count: @batch.success_count)
%p
= link_to t('.link_text'), instructeur_procedure_path(@procedure, statut: params["statut"]), data: { action: 'turbo-poll#refresh' }
= t('.after_link_text')
%p.fr-mt-2w
%small= t('.context', mail: @batch.instructeur.email, time_ago: time_ago_in_words(@batch.created_at))

View file

@ -128,10 +128,6 @@ class BatchOperation < ApplicationRecord
dossier_operations.size
end
def progress_count
dossier_operations.pending.size
end
def success_count
dossier_operations.success.size
end

View file

@ -23,6 +23,7 @@ RSpec.describe Dossiers::BatchAlertComponent, type: :component do
it { is_expected.to have_selector('.fr-alert--info') }
it { is_expected.to have_text("Une action de masse est en cours") }
it { is_expected.to have_text("1/2 dossiers ont été archivés") }
it { is_expected.to have_text("Cette opération a été lancée par #{instructeur.email}, il y a moins d'une minute") }
end
context 'finished and success' do