use the filter_service
This commit is contained in:
parent
4d7715fbb6
commit
d1530b40a1
2 changed files with 12 additions and 3 deletions
|
@ -95,7 +95,7 @@ module Instructeurs
|
||||||
|
|
||||||
@has_export_notification = notify_exports?
|
@has_export_notification = notify_exports?
|
||||||
@last_export = last_export_for(statut)
|
@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
|
page = params[:page].presence || 1
|
||||||
|
|
||||||
@dossiers_count = @filtered_sorted_ids.size
|
@dossiers_count = @filtered_sorted_ids.size
|
||||||
|
|
|
@ -140,8 +140,8 @@ class Export < ApplicationRecord
|
||||||
if since.present?
|
if since.present?
|
||||||
dossiers.visible_by_administration.where('dossiers.depose_at > ?', since)
|
dossiers.visible_by_administration.where('dossiers.depose_at > ?', since)
|
||||||
elsif procedure_presentation.present?
|
elsif procedure_presentation.present?
|
||||||
filtered_sorted_ids = procedure_presentation
|
instructeur = instructeur_from(user_profile)
|
||||||
.filtered_sorted_ids(dossiers, statut)
|
filtered_sorted_ids = DossierFilterService.filtered_sorted_ids(dossiers, statut, filtered_columns, sorted_column, instructeur)
|
||||||
|
|
||||||
dossiers.where(id: filtered_sorted_ids)
|
dossiers.where(id: filtered_sorted_ids)
|
||||||
else
|
else
|
||||||
|
@ -150,6 +150,15 @@ class Export < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def instructeur_from(user_profile)
|
||||||
|
case user_profile
|
||||||
|
when Administrateur
|
||||||
|
user_profile.instructeur
|
||||||
|
when Instructeur
|
||||||
|
user_profile
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def blob
|
def blob
|
||||||
service = ProcedureExportService.new(procedure, dossiers_for_export, user_profile, export_template)
|
service = ProcedureExportService.new(procedure, dossiers_for_export, user_profile, export_template)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue