diff --git a/app/models/dossier.rb b/app/models/dossier.rb index 93ba7e665..d687c4011 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -560,11 +560,12 @@ class Dossier < ApplicationRecord approximative_expiration_date_reference, conservation_extension, procedure.duree_conservation_dossiers_dans_ds.months - ].compact.sum - REMAINING_WEEKS_BEFORE_EXPIRATION.weeks + ].sum - REMAINING_WEEKS_BEFORE_EXPIRATION.weeks end def close_to_expiration? - return false + return false if en_instruction? + approximative_expiration_date < Time.zone.now end def expiration_date diff --git a/lib/tasks/deployment/20211110093332_set_dossiers_processed_at.rake b/lib/tasks/deployment/20211110093332_set_dossiers_processed_at.rake index 3129c5033..335d7fbe2 100644 --- a/lib/tasks/deployment/20211110093332_set_dossiers_processed_at.rake +++ b/lib/tasks/deployment/20211110093332_set_dossiers_processed_at.rake @@ -7,7 +7,7 @@ namespace :after_party do progress = ProgressReport.new(dossiers.count) dossiers.find_each do |dossier| - if dossier.processed_at != dossier.traitement.processed_at + if dossier.read_attribute(:processed_at) != dossier.traitement.processed_at dossier.update_column(:processed_at, dossier.traitement.processed_at) end progress.inc