fix(export): make count argument optional

This commit is contained in:
Paul Chavard 2022-04-06 09:12:15 +02:00
parent 9904dabffe
commit 23e2429d0d
3 changed files with 4 additions and 4 deletions

View file

@ -76,7 +76,7 @@ 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, @dossiers_count, statut)
filtered_sorted_ids = procedure_presentation.filtered_sorted_ids(dossiers, statut, count: @dossiers_count)
page = params[:page].presence || 1

View file

@ -168,7 +168,7 @@ class Export < ApplicationRecord
dossiers.visible_by_administration.where('dossiers.depose_at > ?', since)
elsif procedure_presentation.present?
filtered_sorted_ids = procedure_presentation
.filtered_sorted_ids(dossiers, dossiers.size, statut)
.filtered_sorted_ids(dossiers, statut)
dossiers.where(id: filtered_sorted_ids)
else

View file

@ -182,9 +182,9 @@ class ProcedurePresentation < ApplicationRecord
end.reduce(:&)
end
def filtered_sorted_ids(dossiers, count, statut)
def filtered_sorted_ids(dossiers, statut, count: nil)
dossiers_by_statut = dossiers.by_statut(instructeur, statut)
dossiers_sorted_ids = self.sorted_ids(dossiers_by_statut, count)
dossiers_sorted_ids = self.sorted_ids(dossiers_by_statut, count || dossiers_by_statut.size)
if filters[statut].present?
filtered_ids(dossiers_by_statut, statut).intersection(dossiers_sorted_ids)