Skip to content

Commit

Permalink
fix apres retours
Browse files Browse the repository at this point in the history
  • Loading branch information
kara22 committed Dec 11, 2024
1 parent 7499b6e commit 9780327
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 33 deletions.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/procedure_list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
background-image: none;
}

li {
border-top: 1px solid var(--border-default-grey);
}

.procedure-logo {
@include ie-compatible-background-image();

Expand Down
6 changes: 1 addition & 5 deletions app/controllers/instructeurs/procedures_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ def index

@dossiers_count_per_procedure = dossiers.by_statut('tous').group('groupe_instructeurs.procedure_id').reorder(nil).count
@dossiers_a_suivre_count_per_procedure = dossiers.by_statut('a-suivre').group('groupe_instructeurs.procedure_id').reorder(nil).count
@dossiers_archived_count_per_procedure = dossiers.by_statut('archives').group('groupe_instructeurs.procedure_id').count
@dossiers_termines_count_per_procedure = dossiers.by_statut('traites').group('groupe_instructeurs.procedure_id').reorder(nil).count
@dossiers_expirant_count_per_procedure = dossiers.by_statut('expirant').group('groupe_instructeurs.procedure_id').count
@dossiers_supprimes_count_per_procedure = dossiers.by_statut('supprimes').group('groupe_instructeurs.procedure_id').reorder(nil).count

groupe_ids = current_instructeur.groupe_instructeurs.pluck(:id)
@followed_dossiers_count_per_procedure = current_instructeur
Expand All @@ -57,9 +55,7 @@ def index
t('.followed') => @followed_dossiers_count_per_procedure.sum { |_, v| v },
t('.processed') => @dossiers_termines_count_per_procedure.sum { |_, v| v },
t('.all') => @dossiers_count_per_procedure.sum { |_, v| v },
t('.dossiers_close_to_expiration') => @dossiers_expirant_count_per_procedure.sum { |_, v| v },
t('.archived') => @dossiers_archived_count_per_procedure.sum { |_, v| v },
t('.dossiers_supprimes') => @dossiers_supprimes_count_per_procedure.sum { |_, v| v }
t('.dossiers_close_to_expiration') => @dossiers_expirant_count_per_procedure.sum { |_, v| v }

Check warning on line 58 in app/controllers/instructeurs/procedures_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/instructeurs/procedures_controller.rb#L58

Added line #L58 was not covered by tests
}

@procedure_ids_en_cours_with_notifications = current_instructeur.procedure_ids_with_notifications(:en_cours)
Expand Down
10 changes: 7 additions & 3 deletions app/helpers/procedure_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ def procedure_libelle(procedure)
end

def procedure_badge(procedure)
return nil unless procedure.brouillon?

tag.span(t('helpers.procedure.testing_procedure'), class: 'fr-badge fr-badge--sm')
if procedure.close?
tag.span('Close', class: 'fr-badge')
elsif procedure.depubliee?
tag.span('Dépubliée', class: 'fr-badge')
elsif procedure.brouillon?
tag.span(t('helpers.procedure.testing_procedure'), class: 'fr-badge fr-badge--sm')
end
end

def procedure_publish_label(procedure, key)
Expand Down
17 changes: 5 additions & 12 deletions app/views/instructeurs/procedures/_list.html.haml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

%li.flex.align-start.fr-mb-3w{ style: "border-top: 1px solid var(--border-default-grey);" }
%li.flex.align-start.fr-mb-3w
.flex

.procedure-details
.flex.clipboard-container
.clipboard-container
.fr-mb-2w.fr-mt-2w
= procedure_badge(p)
%h3.font-weight-normal.fr-link.fr-ml-1w
= badge = procedure_badge(p)
%h3{ class: class_names('font-weight-normal fr-link' => true, 'fr-ml-1v' => badge.present?) }
= link_to "#{p.libelle} - n°#{p.id}", instructeur_procedure_path(p)

= render Dsfr::CopyButtonComponent.new(title: t('instructeurs.procedures.index.copy_link_button'), text: commencer_url(p.path))
Expand Down Expand Up @@ -67,11 +67,4 @@
%span.fr-icon-delete-line
.center.fr-text--xs
= t('instructeurs.dossiers.labels.dossiers_supprimes')


- if p.close?
.ml-auto
%span.fr-badge Close
- elsif p.depubliee?
.ml-auto
%span.fr-badge Dépubliée
r
2 changes: 0 additions & 2 deletions config/locales/views/instructeurs/procedures/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ en:
followed: followed
processed: processed
all: files
archived: archived
dossiers_close_to_expiration: expiring
dossiers_supprimes: recently deleted
copy_link_button: Copy the procedure link to clipboard
show:
file_tracking: File tracking
Expand Down
2 changes: 0 additions & 2 deletions config/locales/views/instructeurs/procedures/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ fr:
followed: suivis
processed: traités
all: dossiers
archived: archivés
dossiers_close_to_expiration: expirant
dossiers_supprimes: supprimés
copy_link_button: Copier le lien de la démarche dans le presse-papiers
show:
file_tracking: Suivi des dossiers
Expand Down
9 changes: 0 additions & 9 deletions spec/controllers/instructeurs/procedures_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@

it { expect(assigns(:dossiers_count_per_procedure)[procedure.id]).to eq(nil) }
it { expect(assigns(:dossiers_a_suivre_count_per_procedure)[procedure.id]).to eq(nil) }
it { expect(assigns(:dossiers_archived_count_per_procedure)[procedure.id]).to eq(nil) }
it { expect(assigns(:followed_dossiers_count_per_procedure)[procedure.id]).to eq(nil) }
it { expect(assigns(:dossiers_termines_count_per_procedure)[procedure.id]).to eq(nil) }
it { expect(assigns(:dossiers_expirant_count_per_procedure)[procedure.id]).to eq(nil) }
Expand All @@ -101,7 +100,6 @@
it { expect(assigns(:all_dossiers_counts)['suivis']).to eq(0) }
it { expect(assigns(:all_dossiers_counts)['traités']).to eq(0) }
it { expect(assigns(:all_dossiers_counts)['dossiers']).to eq(0) }
it { expect(assigns(:all_dossiers_counts)['archivés']).to eq(0) }
it { expect(assigns(:all_dossiers_counts)['expirant']).to eq(0) }
end

Expand Down Expand Up @@ -149,14 +147,12 @@
it { expect(assigns(:dossiers_count_per_procedure)[procedure.id]).to eq(5) }
it { expect(assigns(:dossiers_a_suivre_count_per_procedure)[procedure.id]).to eq(3) }
it { expect(assigns(:followed_dossiers_count_per_procedure)[procedure.id]).to eq(nil) }
it { expect(assigns(:dossiers_archived_count_per_procedure)[procedure.id]).to eq(1) }
it { expect(assigns(:dossiers_termines_count_per_procedure)[procedure.id]).to eq(2) }
it { expect(assigns(:dossiers_expirant_count_per_procedure)[procedure.id]).to eq(2) }

it { expect(assigns(:dossiers_count_per_procedure)[procedure2.id]).to eq(3) }
it { expect(assigns(:dossiers_a_suivre_count_per_procedure)[procedure2.id]).to eq(nil) }
it { expect(assigns(:followed_dossiers_count_per_procedure)[procedure2.id]).to eq(1) }
it { expect(assigns(:dossiers_archived_count_per_procedure)[procedure2.id]).to eq(nil) }
it { expect(assigns(:dossiers_termines_count_per_procedure)[procedure2.id]).to eq(1) }

it { expect(assigns(:dossiers_count_per_procedure)[procedure3.id]).to eq(2) }
Expand All @@ -165,7 +161,6 @@
it { expect(assigns(:all_dossiers_counts)['suivis']).to eq(0 + 1) }
it { expect(assigns(:all_dossiers_counts)['traités']).to eq(2 + 1 + 1 + 1) }
it { expect(assigns(:all_dossiers_counts)['dossiers']).to eq(5 + 3 + 2 + 1) }
it { expect(assigns(:all_dossiers_counts)['archivés']).to eq(1 + 0) }
it { expect(assigns(:all_dossiers_counts)['expirant']).to eq(2 + 0) }

it { expect(assigns(:procedures_en_cours)).to match_array([procedure2, procedure, procedure3]) }
Expand Down Expand Up @@ -223,13 +218,11 @@
it { expect(assigns(:followed_dossiers_count_per_procedure)[procedure.id]).to eq(6) }
it { expect(assigns(:dossiers_termines_count_per_procedure)[procedure.id]).to eq(10) }
it { expect(assigns(:dossiers_count_per_procedure)[procedure.id]).to eq(4 + 6 + 10) }
it { expect(assigns(:dossiers_archived_count_per_procedure)[procedure.id]).to eq(14) }

it { expect(assigns(:all_dossiers_counts)['à suivre']).to eq(4) }
it { expect(assigns(:all_dossiers_counts)['suivis']).to eq(6) }
it { expect(assigns(:all_dossiers_counts)['traités']).to eq(10) }
it { expect(assigns(:all_dossiers_counts)['dossiers']).to eq(4 + 6 + 10) }
it { expect(assigns(:all_dossiers_counts)['archivés']).to eq(14) }
end

context 'when an instructeur only belongs to one of them gi' do
Expand All @@ -244,13 +237,11 @@
it { expect(assigns(:followed_dossiers_count_per_procedure)[procedure.id]).to eq(3) }
it { expect(assigns(:dossiers_termines_count_per_procedure)[procedure.id]).to eq(5) }
it { expect(assigns(:dossiers_count_per_procedure)[procedure.id]).to eq(2 + 3 + 5) }
it { expect(assigns(:dossiers_archived_count_per_procedure)[procedure.id]).to eq(7) }

it { expect(assigns(:all_dossiers_counts)['à suivre']).to eq(2) }
it { expect(assigns(:all_dossiers_counts)['suivis']).to eq(3) }
it { expect(assigns(:all_dossiers_counts)['traités']).to eq(5) }
it { expect(assigns(:all_dossiers_counts)['dossiers']).to eq(2 + 3 + 5) }
it { expect(assigns(:all_dossiers_counts)['archivés']).to eq(7) }
end
end
end
Expand Down

0 comments on commit 9780327

Please sign in to comment.