From 436569b08cb022f319ddef175daa4d0290291099 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 7 Dec 2021 13:32:27 +0100 Subject: [PATCH 1/3] Revert "Merge pull request #6727 from tchak/fix-approximative_expiration_date-again" This reverts commit 951f9744787114219bfcc64a2eea4babcf7ca5b9, reversing changes made to c95a67d970aa64cace526e49f1d2233e1102630f. --- app/models/dossier.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/dossier.rb b/app/models/dossier.rb index 93ba7e665..2a40eaa14 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -564,7 +564,8 @@ class Dossier < ApplicationRecord end def close_to_expiration? - return false + return false if en_instruction? + approximative_expiration_date < Time.zone.now end def expiration_date From 5615baa98597bb1635d22e6159ec140e42df978a Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 7 Dec 2021 13:32:39 +0100 Subject: [PATCH 2/3] Revert "Merge pull request #6724 from tchak/fix-approximative_expiration_date" This reverts commit c95a67d970aa64cace526e49f1d2233e1102630f, reversing changes made to 032989a400b3c53367ad09a8a8fe4dc0b5c8db31. --- app/models/dossier.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/dossier.rb b/app/models/dossier.rb index 2a40eaa14..d687c4011 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -560,7 +560,7 @@ 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? From 612b3bd82d2827d93b40cbe7c17fb4e8bdf8938e Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 7 Dec 2021 13:36:59 +0100 Subject: [PATCH 3/3] fix(task): use dossier.read_attribute instead of direct read --- .../deployment/20211110093332_set_dossiers_processed_at.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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