Merge pull request #9930 from demarches-simplifiees/add-external-link-to-procedure

ETQ admin lorsque je clos une démarche je peux alerter les usagers et je crée une page de fermeture si la démarche n'est pas redirigée dans DS
This commit is contained in:
Colin Darie 2024-03-12 15:03:30 +00:00 committed by GitHub
commit ee92668611
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
40 changed files with 721 additions and 47 deletions

View file

@ -0,0 +1,23 @@
# frozen_string_literal: true
module Maintenance
class BackfillClosingReasonInClosedProceduresTask < MaintenanceTasks::Task
def collection
Procedure
.with_discarded
.where(aasm_state: :close)
end
def process(procedure)
if procedure.replaced_by_procedure_id.present?
procedure.update!(closing_reason: Procedure.closing_reasons.fetch(:internal_procedure))
else
procedure.update!(closing_reason: Procedure.closing_reasons.fetch(:other))
end
end
def count
collection.count
end
end
end