Overload the finished_at

This commit is contained in:
Lisa Durand 2023-02-01 14:59:37 +01:00
parent d0a131dc55
commit 120fbb0ef7
5 changed files with 26 additions and 39 deletions

View file

@ -95,6 +95,7 @@ class BatchOperation < ApplicationRecord
def track_processed_dossier(success, dossier)
dossiers.delete(dossier)
touch(:run_at) if called_for_first_time?
touch(:finished_at)
if success
dossier_operation(dossier).done!
@ -139,6 +140,10 @@ class BatchOperation < ApplicationRecord
dossier_operations.error.present?
end
def finished_at
dossiers.empty? ? run_at : nil
end
private
def dossier_operation(dossier)