use the filter_service

This commit is contained in:
simon lehericey 2024-10-15 13:28:44 +02:00
parent 4d7715fbb6
commit d1530b40a1
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
2 changed files with 12 additions and 3 deletions

View file

@ -95,7 +95,7 @@ module Instructeurs
@has_export_notification = notify_exports?
@last_export = last_export_for(statut)
@filtered_sorted_ids = procedure_presentation.filtered_sorted_ids(dossiers, statut, count: dossiers_count)
@filtered_sorted_ids = DossierFilterService.filtered_sorted_ids(dossiers, statut, procedure_presentation.filters_for(statut), procedure_presentation.sorted_column, current_instructeur, count: dossiers_count)
page = params[:page].presence || 1
@dossiers_count = @filtered_sorted_ids.size

View file

@ -140,8 +140,8 @@ class Export < ApplicationRecord
if since.present?
dossiers.visible_by_administration.where('dossiers.depose_at > ?', since)
elsif procedure_presentation.present?
filtered_sorted_ids = procedure_presentation
.filtered_sorted_ids(dossiers, statut)
instructeur = instructeur_from(user_profile)
filtered_sorted_ids = DossierFilterService.filtered_sorted_ids(dossiers, statut, filtered_columns, sorted_column, instructeur)
dossiers.where(id: filtered_sorted_ids)
else
@ -150,6 +150,15 @@ class Export < ApplicationRecord
end
end
def instructeur_from(user_profile)
case user_profile
when Administrateur
user_profile.instructeur
when Instructeur
user_profile
end
end
def blob
service = ProcedureExportService.new(procedure, dossiers_for_export, user_profile, export_template)