demarches-normaliennes/app/tasks/maintenance/fix_open_procedures_with_closing_reason_task.rb
2024-03-22 16:00:36 +01:00

18 lines
391 B
Ruby

# frozen_string_literal: true
module Maintenance
class FixOpenProceduresWithClosingReasonTask < MaintenanceTasks::Task
def collection
Procedure
.with_discarded
.where
.not(aasm_state: [:close, :depubliee])
.where
.not(closing_reason: nil)
end
def process(procedure)
procedure.update!(closing_reason: nil)
end
end
end