diff --git a/app/controllers/manager/procedures_controller.rb b/app/controllers/manager/procedures_controller.rb index 33843a6c1..ec45022a9 100644 --- a/app/controllers/manager/procedures_controller.rb +++ b/app/controllers/manager/procedures_controller.rb @@ -40,8 +40,8 @@ module Manager end def export_mail_brouillons - dossiers = procedure.dossiers.state_brouillon - emails = dossiers.map { |d| d.user.email }.sort + dossiers = procedure.dossiers.state_brouillon.includes(:user) + emails = dossiers.map { |d| d.user.email }.sort.uniq date = Time.zone.now.strftime('%d-%m-%Y') send_data(emails.join("\n"), :filename => "brouillons-#{procedure.id}-au-#{date}.csv") end