fix(data): update closing_reason to other if no replaced_by_procedure_id
This commit is contained in:
parent
e55531c6f4
commit
234f0d7a75
2 changed files with 40 additions and 0 deletions
|
@ -0,0 +1,17 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Maintenance
|
||||
class UpdateClosingReasonIfNoReplacedByIdTask < MaintenanceTasks::Task
|
||||
def collection
|
||||
Procedure
|
||||
.with_discarded
|
||||
.closes
|
||||
.where(closing_reason: Procedure.closing_reasons.fetch(:internal_procedure))
|
||||
.where(replaced_by_procedure_id: nil)
|
||||
end
|
||||
|
||||
def process(procedure)
|
||||
procedure.update!(closing_reason: Procedure.closing_reasons.fetch(:other))
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue