diff --git a/app/controllers/instructeurs/procedures_controller.rb b/app/controllers/instructeurs/procedures_controller.rb index e72caa804..dda4c0394 100644 --- a/app/controllers/instructeurs/procedures_controller.rb +++ b/app/controllers/instructeurs/procedures_controller.rb @@ -15,9 +15,9 @@ module Instructeurs dossiers = current_instructeur.dossiers.joins(:groupe_instructeur) @dossiers_count_per_procedure = dossiers.all_state.group('groupe_instructeurs.procedure_id').reorder(nil).count @dossiers_a_suivre_count_per_procedure = dossiers.without_followers.en_cours.group('groupe_instructeurs.procedure_id').reorder(nil).count - @dossiers_archived_count_per_procedure = dossiers.archived.group('groupe_instructeurs.procedure_id').count + @dossiers_archived_count_per_procedure = dossiers.archived.group('groupe_instructeurs.procedure_id').count #why not reorder(nil) @dossiers_termines_count_per_procedure = dossiers.termine.group('groupe_instructeurs.procedure_id').reorder(nil).count - + @dossiers_expirant_count_per_procedure = dossiers.close_to_expiration.group('groupe_instructeurs.procedure_id').count #why not reorder(nil) groupe_ids = current_instructeur.groupe_instructeurs.pluck(:id) @followed_dossiers_count_per_procedure = current_instructeur @@ -34,7 +34,8 @@ module Instructeurs 'suivis' => @followed_dossiers_count_per_procedure.sum { |_, v| v }, 'traités' => @dossiers_termines_count_per_procedure.sum { |_, v| v }, 'dossiers' => @dossiers_count_per_procedure.sum { |_, v| v }, - 'archivés' => @dossiers_archived_count_per_procedure.sum { |_, v| v } + 'archivés' => @dossiers_archived_count_per_procedure.sum { |_, v| v }, + 'expirant' => @dossiers_expirant_count_per_procedure.sum { |_, v| v } } @procedure_ids_en_cours_with_notifications = current_instructeur.procedure_ids_with_notifications(:en_cours) diff --git a/app/views/instructeurs/procedures/_list.html.haml b/app/views/instructeurs/procedures/_list.html.haml index a0b1ca2a5..96c25d2b2 100644 --- a/app/views/instructeurs/procedures/_list.html.haml +++ b/app/views/instructeurs/procedures/_list.html.haml @@ -52,6 +52,14 @@ = number_with_html_delimiter(archived_count) .stats-legend = t('pluralize.archived', count: archived_count) + %li + %object + = link_to(instructeur_procedure_path(p, statut: 'expirant')) do + - expirant_count = dossiers_expirant_count_per_procedure[p.id] || 0 + .stats-number + = number_with_html_delimiter(expirant_count) + .stats-legend + = t('pluralize.dossiers_close_to_expiration', count: expirant_count) - if p.close? .procedure-status diff --git a/app/views/instructeurs/procedures/index.html.haml b/app/views/instructeurs/procedures/index.html.haml index 3616a7090..4356c463e 100644 --- a/app/views/instructeurs/procedures/index.html.haml +++ b/app/views/instructeurs/procedures/index.html.haml @@ -12,6 +12,7 @@ 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, + dossiers_expirant_count_per_procedure: @dossiers_expirant_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 }