[#10951] fixes after review
This commit is contained in:
parent
5ab0899a49
commit
39baa5aae1
3 changed files with 7 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Cron::NotifyOldBrouillonDossiersSoonDeletedJob < Cron::CronJob
|
||||
self.schedule_expression = "every day at 9:00"
|
||||
self.schedule_expression = "every day at 6:00"
|
||||
|
||||
def perform
|
||||
Dossier
|
||||
|
@ -9,7 +9,7 @@ class Cron::NotifyOldBrouillonDossiersSoonDeletedJob < Cron::CronJob
|
|||
.where(updated_at: ..3.months.ago)
|
||||
.where("notified_soon_deleted_sent_at IS NULL OR notified_soon_deleted_sent_at < updated_at")
|
||||
.find_each do |dossier|
|
||||
DossierMailer.notify_old_brouillon_soon_deleted(dossier).deliver_later
|
||||
DossierMailer.notify_old_brouillon_soon_deleted(dossier).deliver_later(wait: rand(0..3.hours))
|
||||
dossier.update_column(:notified_soon_deleted_sent_at, Time.zone.now)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Cron::PurgeOldBrouillonDossiersJob < Cron::CronJob
|
||||
self.schedule_expression = "every day at 08:30"
|
||||
self.schedule_expression = "every day at 5:30"
|
||||
|
||||
def perform
|
||||
Dossier
|
||||
|
|
|
@ -567,7 +567,10 @@ class Dossier < ApplicationRecord
|
|||
end
|
||||
|
||||
def can_be_deleted_by_automatic?(reason)
|
||||
reason == :expired && !en_instruction? || reason == :not_modified_for_a_long_time && brouillon?
|
||||
return true if reason == :expired && !en_instruction?
|
||||
return true if reason == :not_modified_for_a_long_time && brouillon?
|
||||
|
||||
false
|
||||
end
|
||||
|
||||
def can_terminer_automatiquement_by_sva_svr?
|
||||
|
|
Loading…
Reference in a new issue