From 5bfcae1c0f50404c4abcdbf6a50b9a0a265bc746 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 6 Apr 2022 17:08:22 +0200 Subject: [PATCH] fix(dossiers): show correct count on download button --- app/controllers/instructeurs/procedures_controller.rb | 5 +++-- app/views/instructeurs/procedures/show.html.haml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/instructeurs/procedures_controller.rb b/app/controllers/instructeurs/procedures_controller.rb index 504cf671a..172891bc8 100644 --- a/app/controllers/instructeurs/procedures_controller.rb +++ b/app/controllers/instructeurs/procedures_controller.rb @@ -63,7 +63,7 @@ module Instructeurs @can_download_dossiers = (@counts[:tous] + @counts[:archives]) > 0 dossiers = Dossier.where(groupe_instructeur_id: groupe_instructeur_ids) - @dossiers_count = @counts[statut.underscore.to_sym] + dossiers_count = @counts[statut.underscore.to_sym] @followed_dossiers_id = current_instructeur .followed_dossiers @@ -76,10 +76,11 @@ module Instructeurs @has_termine_notifications = notifications[:termines].present? @not_archived_notifications_dossier_ids = notifications[:en_cours] + notifications[:termines] - filtered_sorted_ids = procedure_presentation.filtered_sorted_ids(dossiers, statut, count: @dossiers_count) + filtered_sorted_ids = procedure_presentation.filtered_sorted_ids(dossiers, statut, count: dossiers_count) page = params[:page].presence || 1 + @dossiers_count = filtered_sorted_ids.size @filtered_sorted_paginated_ids = Kaminari .paginate_array(filtered_sorted_ids) .page(page) diff --git a/app/views/instructeurs/procedures/show.html.haml b/app/views/instructeurs/procedures/show.html.haml index 213c33151..feae02087 100644 --- a/app/views/instructeurs/procedures/show.html.haml +++ b/app/views/instructeurs/procedures/show.html.haml @@ -58,8 +58,9 @@ .flex .flex-grow = render partial: "dossiers_filter", locals: { procedure: @procedure, procedure_presentation: @procedure_presentation, current_filters: @current_filters, statut: @statut, displayed_fields_options: @displayed_fields_options } - .dossiers-export - = render partial: "dossiers_export", locals: { procedure: @procedure, exports: @exports, statut: @statut, count: @dossiers_count } + - if @dossiers_count > 0 + .dossiers-export + = render partial: "dossiers_export", locals: { procedure: @procedure, exports: @exports, statut: @statut, count: @dossiers_count } %table.table.dossiers-table.hoverable %thead