unique emails + remove n+1

This commit is contained in:
clemkeirua 2020-05-18 12:17:21 +02:00 committed by GitHub Action
parent 22a518c921
commit 8542fd9f47

View file

@ -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