2020-03-28 16:49:40 +01:00
|
|
|
class WarnExpiringDossiersJob < CronJob
|
2020-04-01 15:26:46 +02:00
|
|
|
self.schedule_expression = "every 1 month at midnight"
|
2018-08-31 17:46:12 +02:00
|
|
|
|
|
|
|
def perform(*args)
|
|
|
|
expiring, expired = Dossier
|
2020-02-26 17:43:37 +01:00
|
|
|
.en_instruction_close_to_expiration
|
2018-08-31 17:46:12 +02:00
|
|
|
.partition(&:retention_expired?)
|
|
|
|
|
|
|
|
AdministrationMailer.dossier_expiration_summary(expiring, expired).deliver_later
|
|
|
|
end
|
|
|
|
end
|