diff --git a/app/controllers/instructeurs/procedures_controller.rb b/app/controllers/instructeurs/procedures_controller.rb index c077e3d5c..5ab52a73c 100644 --- a/app/controllers/instructeurs/procedures_controller.rb +++ b/app/controllers/instructeurs/procedures_controller.rb @@ -37,6 +37,9 @@ module Instructeurs 'dossiers' => @dossiers_count_per_procedure.sum { |_, v| v }, 'archivés' => @dossiers_archived_count_per_procedure.sum { |_, v| v } } + + @procedure_ids_en_cours_with_notifications = current_instructeur.procedure_ids_with_notifications(:en_cours) + @procedure_ids_termines_with_notifications = current_instructeur.procedure_ids_with_notifications(:termine) end def show diff --git a/app/views/instructeurs/procedures/_list.html.haml b/app/views/instructeurs/procedures/_list.html.haml index f20cc4e3d..438587bb4 100644 --- a/app/views/instructeurs/procedures/_list.html.haml +++ b/app/views/instructeurs/procedures/_list.html.haml @@ -21,7 +21,7 @@ %li %object = link_to(instructeur_procedure_path(p, statut: 'suivis')) do - - if current_instructeur.procedure_ids_with_notifications(:en_cours).include?(p.id) + - if procedure_ids_en_cours_with_notifications.include?(p.id) %span.notifications{ 'aria-label': "notifications" } - followed_count = followed_dossiers_count_per_procedure[p.id] || 0 .stats-number @@ -31,7 +31,7 @@ %li %object = link_to(instructeur_procedure_path(p, statut: 'traites')) do - - if current_instructeur.procedure_ids_with_notifications(:termine).include?(p.id) + - if procedure_ids_termines_with_notifications.include?(p.id) %span.notifications{ 'aria-label': "notifications" } - termines_count = dossiers_termines_count_per_procedure[p.id] || 0 .stats-number diff --git a/app/views/instructeurs/procedures/index.html.haml b/app/views/instructeurs/procedures/index.html.haml index d2275f38b..405c3fc69 100644 --- a/app/views/instructeurs/procedures/index.html.haml +++ b/app/views/instructeurs/procedures/index.html.haml @@ -9,4 +9,6 @@ dossiers_a_suivre_count_per_procedure: @dossiers_a_suivre_count_per_procedure, dossiers_archived_count_per_procedure: @dossiers_archived_count_per_procedure, dossiers_termines_count_per_procedure: @dossiers_termines_count_per_procedure, - followed_dossiers_count_per_procedure: @followed_dossiers_count_per_procedure } + followed_dossiers_count_per_procedure: @followed_dossiers_count_per_procedure, + procedure_ids_en_cours_with_notifications: @procedure_ids_en_cours_with_notifications, + procedure_ids_termines_with_notifications: @procedure_ids_termines_with_notifications }